How to setup samba for multiplatform sharing

Easy steps explaining how to setup samba. Transform any linux machine into a NAS you can use to share files on your whole network, in a multi platform configuration.

Install samba : apt-get update && apt-get install samba If you want to use NTFS volumes : apt-get install fuse ntfs-3g

Let's assume you want to share a volume mounted in /storage and your user name is userx. Perform as root.

Give ownership to userx on /storage/ chown -R userx /storage/

Define samba password for userx smbpasswd -a userx

Add samba user group groupadd smbusers

Give ownership to samba user group on /storage/ chown :smbusers /storage/

Add userx to samba user group usermod -G smbusers userx

Now edit samba configuration nano /etc/samba/smb.conf add this at the end :

comment = Storage
path = /storage
valid users = @userx
force group = smbusers
create mask = 0750
directory mask = 0771
read only = no
guest ok = no
browsable = no

Optional reading : Samba configuration manual

Restart samba to apply service smbd restart && service nmbd restart


Type ifconfig to see your local ip, then you can access your shares from that address.

Type \\\Storage in the file explorer address on a windows machine for example

Mount samba share from linux CLI : mount -t cifs // /mnt/storage -o user=userx,pass=XXXXXXXXXXXXXXXX

You may need apt-get install cifs-utils