Samba on Linux

Updated 20-Sep-2023

If one wants to say, stream video or music from a file system, but using a different computer. This is not difficult with Samba (aka CIFS) on Linux. Using apps like VLC on Google TV will allow connectivity to the drive over the network.

Install and Configure SMB

sudo apt install samba
sudo nano /etc/samba/smb.conf

At the end of the file, add:

[directory share name]
path = /media/user/external-drive-name
writeable = yes
valid users = username1, username2
read only = no
browsable = yes

Note that changing writeable and read only to no and yes, respectively, make it so.

Manual USB drive mapping (if needed)

Ensure that path (above) and (below) do match. This code works for a single external USB drive, formatted NTFS, and found at \dev\sdb1:

sudo mount -t ntfs-3g /dev/sdb1 /media/user/external-drive-name -o uid=1000

Enable / Restart smbd service

sudo service smbd restart

Enable Samba on whichever firewall one has, such as:

sudo ufw allow samba

Add Samba users

Samba does not use the Linux user accounts, so one must create users and passwords individually.

sudo smbpasswd -a username

Known issue on Nemo

  • Sometimes there is an error message on trying to connect with Nemo to a share that it previously connected to. This is an open bug on Github. Use killall nemo then restart and it should work again.