Clients can't create symlinks on Samba share
As recommended in many answers to questions about samba shares and symlinks, I have tried explicitly enabling "follow symlinks" (although documentation says it is on by default) as well as enabling "wide links" and "allow insecure wide links" (although these are related to symlinks that point to outside the shared folder and not turning symlinks on or off)... Symlink creation has not been enabled by modifying these settings.
Samba share is served from a Debian 8 host and accessed from a Debian 9 client.
This is an example of the output I get when attempting to create a symlink in a mounted share:
$ touch hello.txt
$ ln -s hello.txt hello.sl
ln: failed to create symbolic link ‘hello.sl’: Operation not supported
I have run out of ideas and search results, so any input is welcome.
EDIT 1:
Host smb.conf:
[global]
security = USER
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
server min protocol = SMB2
client min protocol = SMB2
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
[share_name]
path = /path/to/folder
force user = hostusername
force group = hostgroupname
read only = No
force create mode = 0660
force directory mode = 0770
case sensitive = Yes
Client mount command:
sudo mount -t cifs //ip.add.re.ss/share_name /path/to/mount -o username=hostusername,vers=3.0,uid=clientusername,gid=clientgroupname,soft,rsize=8192,wsize=8192
Solution 1:
Thanks to @grawity for hinting that my problem might be related to the protocol version. I found a solution that enable symlinks with SMB3 by adding the mfsymlinks
option to the mount command like so:
sudo mount -t cifs //ip.add.re.ss/share_name /path/to/mount -o username=hostusername,vers=3.0,uid=clientusername,gid=clientgroupname,soft,rsize=8192,wsize=8192,mfsymlinks
I don't fully understand the difference between a normal symlink and the Minshall+French symlinks, but it appears to work for my case.
Sources:
https://www.systutorials.com/docs/linux/man/8-mount.cifs/
https://wiki.samba.org/index.php/UNIX_Extensions#Minshall.2BFrench_symlinks).
Solution 2:
This way works for me:
sudo mount -t cifs -o user=user,pass=pass,vers=3.0,uid=987,gid=0,soft,rsize=8192,wsize=8192,mfsymlinks //10.10.10.10/git /var/opt/gitlab/git-data/repositories
Solution 3:
Creating real symlinks does work when using SMB protocol version 1.0 (the classic CIFS/SMBv1 protocol):
... -o ...,vers=1.0,...
Experiments and research showed that since version 2.0 this seems not to be allowed anymore (I hope to stand corrected).
When connecting with the (new) option mfsymlinks, symlinks created on the share are not real symbolic links but so-called Minshall+French symlinks, which are actually text files interpreted by the cifs client as symbolic links (but quite useless on the server itself).