Can't create or follow symlinks from linux client with a cifs mounted Windows Server 2008 R2 share

Windows Server 2008 R2 NTFS supports symlinks. If I log into the server as Administrator I can create symlinks with mklink, so I know the Admin user has the permissions to do this. If I mount a share onto an Ubuntu 10 client using mount -t cifs -o username='domain\Administrator' //server-name/smbshare /mnt/smbshare

and then try to create a symlink to a test file by doing ln -s testfile test_symlink I get the error 'ln: creating symbolic link `test_symlink': Operation not supported'

If I try just to read the contents of an existing symlink (created previously by shelling into the server) I get an 'Operation not supported' error. I have tried this with unix extensions = yes, follow symlinks = yes and wide links = yes in my smb.conf, and without them present.

Any ideas?

Further to this it seems that it's likely SMB1 does not support symlinks even if the underlying volume does. However SMB2 does - so I've tried this on a Fedora Core 13 VM which is running Samba 3.5.4, I set max protocol=smb2, with the same result as above. It's unclear to me though whether mount -t cifs actually utilises the underlying samba machinery, or whether it's a separate implementation...


Solution 1:

...and ... is the linux CIFS driver an SMB2 client?

I have encountered a similar problem:

A SAMBA share setup up on a linux server contains symlinks. I have set "follow symlinks = yes" in my server's smb.conf.

My Windows XP clients can correctly follow the symlink (it points to a directory), but when I mount that SAMBA share to my linux laptop using CIFS, my linux client sees that symlink as a file.

Someone reported this as a bug to the Ubuntu forums as well:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/137756

but the report has been closed with no action.

My linux client is running kernel 2.6.33, and appears to have mount.cifs version 1.52 or better (according to the MAN page).

It's unclear to me though whether mount -t cifs actually utilises the underlying samba machinery, or whether it's a separate implementation...

According to the manpage, mount.cifs ignores the smb.conf file on the client.

Solution 2:

symbolic links will only work with an smb2 client. Otherwise you can set junction points on the server and these will show through to the client as regular files.