Updated 21-Nov-2024
Note: to be honest I'm a bit lost with my configuration. I've had a bit of trouble but it looks like it is ultimately due to the USB interface I'm using to connect HDDs and sharing them. In any case, Samba is working, but I'm not too sure about what kind of mapping to do, and I've had severe problems with that in addition to fstab
. Without fstab
then fewer problems (e.g., I can boot up), but still various issues with timeouts, freezing, and crashing. Currently I'm ok without fstab
and using the direct USB connections rather than via a powered hub. In any case, take with a grain...
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
- After WORKGROUP, add:
min protocol = SMB2
That will fix a chromecast connection issue for VLC on Android (Android TV / Google TV)
Also,
force user = folderuser
if you want to require a single user access, such as to personal directories
- Uncomment the hosts allow section to only the local subnet
- Comment out the
[homes]
home directory section, unless using it
Printers
Make the following settings changes:
- browsable = yes
- guest ok = yes
- printable = yes
At the end of the file, add:
[directory share name]
path = /media/directory
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/directory -o uid=1000
A better approach is to mount in fstab:
- Install
ntfs-3g
sudo apt install ntfs-3g
- Find the disk with
fdisk
sudo fdisk -l
Find the UUID value for the disk (usually sdb1
)
sudo blkid /dev/sdb1
Create the mount directory
sudo mkdir /media/directory
Add to fstab:
sudo nano /etc/fstab
UUID="0123456789ABCDEF" /media/video/ ntfs-3g rw,uid=1000,gid=1000,dmask=0002,fmask=0003 0 0
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.