Samba is re-implementation of the SMB/CIFS networking protocol, samba provides cross-platform file and print services sharing for various Microsoft Windows, OS X and Linux file sharing.

Server Message Block (SMB) or Common Internet File System (CIFS) mainly used for providing shared access to files, printers and serial ports between nodes on a network.

Install Samba

In order for Raspberry Pi to act as SMB server, you need to install packages on the Raspberry Pi. You’re going to need the following packages

  • Samba
    SMB/CIFS file, print, and login server for Unix

To install the Samba packages run following command:

If there is no error in the installation you can continue to the next step

Configure Samba

To configure the samba edit the smb.conf configuration file, you can use an editor such as nano. To open the file, run following command:

Samba’s Configuration

The samba’s configuration setup options allow you to specify several parameters including identification, networking, debugging, authentication, domains, printing, share definitions, and etc.

Default Samba's Configuration

To add Samba’s share definitions configuration

Next step is to add or change the samba’s credentials password for pi users

Restart Samba

To complete the steps you need to restart the Smbd’s service to apply the changes

Testing

To test if Samba working properly on the client

– On Windows

  1. Open Windows Explorer
  2. Right click and select Add a network location
  3. Click Next and select Choose a custom network location
  4. On Internet or Network address type “\\192.168.x.xxx\home\
  5. Click Next to connect to the SMB Server

– On Linux

(Ubuntu)

  1. Open File Manager
  2. Select the Browse Network from the Side Pane
  3. Select Windows Network and then WORKGROUP
  4. Select your Raspberry Pi hostname (e.g. pi, ubuntu, etc.) and then enter SMB Server’s credentials
  5. Click connect to connect to the SMB Server

(Lubuntu)

  1. Open File Manager
  2. Click Go on the Menu bar and then select Network Drives
  3. Select Windows Network and then WORKGROUP
  4. Select your Raspberry Pi hostname (e.g. pi, ubuntu, etc.) and then enter SMB Server’s credentials
  5. Click connect to connect to the SMB Server

(Alternatively)

  1. Open File Manager
  2. Click Connect to  Server
  3. On Server Address type “smb://192.168.x.xxx/home/”
  4. Click connect to connect to the SMB Server

– On OS X

  1. On the Finder, Select Go > Connect To
  2. Enter “smb://192.168.x.xxx/home”
  3. Click connect to connect to the SMB Server

Troubleshooting

– Windows cannot access \\192.168.x.xxx\home

  • Make sure the host is reachable from the client.
  • Rebooting the PC or SMB server may help solve the issue.
  • Verify that the IP Address and the directory is correct.

References

  1. Samba – opening windows to a wider world
  2. samba package – Debian’s Wiki
  3. OS X: How to connect with File Sharing using SMB – Apple Support
  4. Image – Source: Pearltrees