Tag Archives: smb

Raspberry Pi 2B RAID 5 build – Part 4 – Final

Now we install Samba which is a file sharing program for Linux, it is Linux’s implementation of the SMB file protocol used by Windows. Once installed we can connect to shared folder on the tinypute from other machines.

First, install Samba:

sudo apt-get install samba
sudo apt-get install libpam-smbpass

Second, configure /etc/samba/smb.conf as follows:

# Maximum number of usershare. 0 (default) means that usershare is disabled.
usershare max shares = 100 #Uncomment this line (remove the first character “;”)

[homes]
   comment = Home Directories
   browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to ‘no’ if you want to be able to write to them.
   read only = no

Third, create a folder for users to share

sudo mkdir /mnt/raid5/storage
sudo chmod ug+rwx /mnt/raid5/storage

Fourth, configure smb to share the folder, add the following line to /etc/samba/smb.conf

[storage]
   comment = RAID 5 storage folder
   path = /mnt/raid5
   guest ok = no
   browseable = yes
   create mask = 0600
   directory mask = 0700

Restart the smbd service

sudo service smbd restart

Fifth, we install ufw (uncomplicated firewall) so we can open ports required by Samba.

sudo apt-get install ufw
sudo ufw allow 135
sudo ufw allow 137
sudo ufw allow 138
sudo ufw allow 139
sudo ufw allow 445
sudo ufw enable

Sixth, now we connect to the share we created before in /mnt/raid5 (i.e. storage folder)

Before connecting the user that will access the share must be created.

sudo smbpasswd -a pi #pi is the user that will connect to the shared folder

smbpasswd

The shared folder can be connected from another PC now.

On my Mac OSX Yosemite using Finder -> Go -> Connect To Server and enter smb://raid5/storage. A password prompt will be provided, enter as Registered User pi with the SMB password you provided before.

That’s it! New folders can be created, renamed, deleted. The same goes for files, you can edit them too.