Clients can't create symlinks on Samba share

6

5

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

tompi

Posted 2018-07-07T10:37:46.923

Reputation: 361

What Samba version is the server running, and which SMB protocol version is being used? Note that Unix/POSIX extensions are still a work in progress in SMBv2/3. – user1686 – 2018-07-07T12:15:16.870

Answers

19

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).

tompi

Posted 2018-07-07T10:37:46.923

Reputation: 361

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

Christian Knoblauch

Posted 2018-07-07T10:37:46.923

Reputation: 21