zoukankan      html  css  js  c++  java
  • 树莓派使用Samba共享文件夹

    转载自:http://raspberrypihq.com/how-to-share-a-folder-with-a-windows-computer-from-a-raspberry-pi/

    Sharing files over the network is often very useful. Whether you need to transfer media files to the Raspberry Pi or you want to use the raspberry as a simple Network-Attached Storage (NAS) device, this guide will show you how to enable file sharing of a folder on the Raspberry Pi running the Raspbian OS.

    Prerequisites & Equipment

    You are going to need the following:

    • A Raspberry Pi (Buy here)
    • A SD Card flashed with the Raspbian OS (Here is a guide if you need)
    • Access to the Raspberry either via keyboard and a monitor or remotely
    • A home network
    • A Windows computer (for this guide we will be running Windows 7)

    Install and configure required software

    To share network folders to a Windows computer we need to install some special software on the Raspberry Pi. The software providing the secret sauce this time is called Samba. The Samba software package implements the SMB protocol and provides support for the Windows naming service (WINS) and for joining a Windows Workgroup.

    Installing the software is easy – login to your Raspberry Pi and run:

    sudo apt-get install samba samba-common-bin

    After installation configure the software by opening the file /etc/samba/smb.conf using the command:

    sudo nano /etc/samba/smb.conf

    Read through the file and make sure you have the following parameters set:

    workgroup = WORKGROUP
    wins support = yes

    You can use anything as your workgroup name as long as it is alphanumerical and matches the workgroup you would like to join. The default workgroup in Windows 7 is WORKGROUP.

    Setup folder to share

    Next step is to create the folder you would like to share. To create a folder called “share” in your home directory do the following:

    mkdir ~/share

    With the folder created we can now tell the Samba software to share it on the network. Open the file /etc/samba/smb.conf using the command:

    sudo nano /etc/samba/smb.conf

    Scroll to the bottom and add the following:

    [PiShare]
     comment=Raspberry Pi Share
     path=/home/pi/share
     browseable=Yes
     writeable=Yes
     only guest=no
     create mask=0777
     directory mask=0777
     public=no

    Notice how we tell Samba that public access is not allowed via “public=no” – this means that anyone wanting to access the shared folder must login with a valid user.

    In this case the valid user is the user called “pi”. To let Samba know that “pi” is a network user run the command:

    sudo smbpasswd -a pi

    And enter pi’s password twice (default: raspberry).

    At this point we can now login to the share from our Windows computer – use Domain: raspberrypi, User: pi and Password: raspberry (unless you changed the password) as you can see below:

    Login to shared folder on Raspberry Pi

    If you do not want to deal with logging in you can always make the share publicly available by changing the config file to say:

    public=yes

    However please note that this is extremely dangerous since anyone will be able to access, modify and delete your files.

  • 相关阅读:
    javascript获取本地机器信息
    js中获取日期格式
    C#.NET 对HashTable数组进行按值排序
    c# 修饰符
    Android浏览器软键盘中的回车(确认)会触发表单提交的问题解决办法
    excel 选择一个单元格,高亮一行
    Berkeley Language Model
    [转]sqlserver2005 【用户 'sa' 登录失败。该用户与可信 SQL Server 连接无关联】解决方案
    Berkeley Parser
    自然语言处理(NLP)网上资源整理 (转)
  • 原文地址:https://www.cnblogs.com/itlqs/p/6812453.html
Copyright © 2011-2022 走看看