Samba mount isn’t following a symlink

mountsambasmbfssymbolic-linksymlink

I am running two servers and wish to mount a directory on one from the other. For various reasons, I wish to use Samba (smbfs) rather than NFS.

ServerA mounts ServerB with this in the fstab:

//ServerB/sambashare /mount/point smbfs username=blah,password=blah,ro

This works, and I can see the contents of sambashare in /mount/point. However, a symlink in that directory which, on Server A, points at /tmp/blah is not resolving correctly. If I try to go into the directory, it says Permission denied.

The Samba server on ServerB has the following global settings:

follow symlinks = yes
wide links = yes

Any suggestions on why this may not be working? The link does resolve correctly locally on ServerB.

(The names of servers, shares, etc. have been changed to protect the innocent.)

Best Answer

smbfs is the old kernel smb implementation which is no longer actively supported. It's been replaced with the cifs kernel module instead. So try mounting it with type cifs instead of smbfs.

Also make sure that you do not have "Unix Extensions = No" in your smb.conf as this will also disable the kernel modules ability to follow symbolic links. This value defaults to yes so if it's not in your smb.conf you should be all set here.

You may also want to store your credentials in a safer spot as anyone can read /etc/fstab.

To do this do the following as root.

cd /etc/samba/
echo username=mywindowsusername > .smbpasswd
echo password=mywindowspassword >> .smbpasswd
chmod 600 .smbpasswd

Substitute your Windows username and password in the commands. No one else except root would be able to read the contents of this file.

Then modify the line in the /etc/fstab file to look like this:

//servername/sharename /mountdirectory cifs credentials=/etc/samba/.smbpasswd 0 0