Can I avoid that ln fails to create a symbolic link on a network share?

I try to create a symbolic link like this

ln -s Compilations _Compilations

but I get the error “ln: failed to create symbolic link ‘_Compilations’: Operation not supported”.

It must have something to do with the directory I am in, because when I do the same in my home diretory it works. The directory where ln fails is on a network share. The fstab entry for that share looks like:

//[ip-address/music    /shares/music           cifs    credentials=/etc/cifs.creds,uid=[user],gid=[group],file_mode=0755,dir_mode=0755,_netdev 0 0

Is there a way to define this share so that I can do symbolic links?

The filesystem’s type is ‘cifs’. Does CIFS support symbolic links?
Does the actual filesystem that is shared via CIFS support symbolic links?

The answer to the first seems to be “maybe”, according to symlinks on Samba share created by linux client (mfsymlink) not working on server - Super User

1 Like

Thanks @jlehtone. I used CIFS only because it seemed easy to install. Is there another filessytem mounting layer which does support symbol links? Here my config:

  • The main OS is Rocky 8 (as VM on a Synology NAS).
  • The file system to mount is on the Synlogy NAS and I have enabled SMB and NFS for this volume.

NFS is the more common way to share files between Linux machines. It definitely supports symlinks.
By the link above, one should be able to use symlinks with CIFS, if mount options are appropriate.

For links within samba shares you have to have “insecure-wide-links” enabled. Here is what I have in smb.conf

# Allow Symlinks - Disable unix extensions 170110, re-enabled, should work
# in Samba 3.0.6 and later. Needed 'allow insecure wide links' to work
# default is yes
         unix extensions = yes
allow insecure wide links = yes

I am not sure you really understand what ‘allow insecure wide links’ does.
By default, Samba sets ‘follow symlinks = yes’, ‘wide links = no’, ‘allow insecure wide links = no’ and ‘unix extensions = yes’.
This means that Samba will follow symlinks inside the shares path, but not externally, but there is a proviso, in the latest Samba versions, ‘unix extensions’ has been renamed to ‘smb1 unix extensions’.
I hope from this, you can see that, because SMBv1 is turned off by default, symlinks no longer work.
What setting ‘allow insecure wide links = yes’ and ‘wide links = yes’ and turning SMBv1 back on does, security wise, it allows you to shoot yourself in the foot.

1 Like

You are right, making links doesn’t work anymore.
I do understand what wide links means, but since I’m the only user on the system that is not publicly available I have an acceptable risk.

The work around is to log into the server and make the links there with the correct user permissions as long as the linked directory is also an allowed share.