Setup SMB share

To access files on your rpi from your windows machine over the local network you have to install Samba. Samba is the Linux version of the SMB protocol.

The SMB (Server Message Block) Protocol is a network file sharing protocol, and as implemented in Microsoft Windows is known as Microsoft SMB Protocol. SMB can be installed by entering:

$ sudo apt-get install samba samba-common-bin

Setup the folder to share

Next step is to select the directory you would like to share, in this example we'll share the home directory.

To setup sharing you'll have to edit smb.conf

$ sudo nano /etc/samba/smb.conf

Find the entries for workgroup and wins support, and set them up as follows:

workgroup = your_workgroup_name
wins support = yes

Next, scroll down to section called Share Definitions. Add the following code at the end

        comment = Pi Home Directory
        read only = no
        create mask = 0777
        directory mask = 0777
        locking = no
        path = /home/pi
        guest ok = no

You'll have to set 'only guest' and 'public' to 'no' so that Samba prompts for a password when you visit the folder.

Finally we'll have to add the user that can access the share. In this example we''ll add user pi

$ sudo smbpasswd -a pi

Enter the password twice and you're set! Your rpi should show up in your Windows network and should be accessible after entering username and password

This option specifies that the username following should be added to the local smbpasswd file, with the new password typed (type for the old password). This option is ignored if the username following already exists in the smbpasswd file and it is treated like a regular change password command. Note that the default passdb backends require the user to already exist in the system password file, else the request to add the user will fail.


Frits 2017-11-24 22:46
Thx! Worked like a charm