[Samba] Are your symlinks identified as symlinks on Samba/SMB shares?

Jeremy Allison jra at samba.org
Thu Sep 21 15:53:09 UTC 2017


On Thu, Sep 21, 2017 at 10:22:45PM +1000, Chris Richards via samba wrote:
> Hi,
> 
> I would appreciate someone testing if their system can recognize symlinks (as below) on their SMB share. My Mac and Windows machines can NOT recognize symlinks on my NAS's SMB share, they just identify symlinks as real files and folders.
> 
> Why is this an issue? Because when I try to copy parts of these backups from the NAS it just loops back on itself forever.
> 
> Eg:
> 
> From NAS (QNAP TS-453A) command line - Symlinks are visible.
> 
> [admin at NASSY ~]# ls -al /share/CACHEDEV1_DATA/Download/_backups/rsnapshot/mac/daily.0/gir/Users/chrisric/Library/Containers/com.apple.AddressBook/Data/Library/
> total 32
> drwx------ 8 501 20 4096 Aug 2 13:09 ./
> drwx------ 4 501 20 4096 Jun 2 2015 ../
> drwx------ 2 501 20 4096 Jun 2 2015 Application Scripts/
> drwx------ 3 501 20 4096 Jun 11 2015 Application Support/
> lrwxrwxrwx 1 501 20 17 Jun 2 2015 Audio -> ../../../../Audio/
> lrwxrwxrwx 1 501 20 24 Jun 2 2015 ColorPickers -> ../../../../ColorPickers/
> lrwxrwxrwx 1 501 20 18 Jun 2 2015 Colors -> ../../../../Colors/
> <snip>
> 
> From Mac 10.12.6 via SMB share - No symlinks visible.
> 
> greyfrog:~ admin$ ls -al /Volumes/Download/_backups/rsnapshot/mac/daily.0/gir/Users/chrisric/Library/Containers/com.apple.AddressBook/Data/Library/
> total 736
> drwx------ 1 admin staff 16384 2 Aug 13:09 .
> drwx------ 1 admin staff 16384 2 Jun 2015 ..
> drwx------ 1 admin staff 16384 2 Jun 2015 Application Scripts
> drwx------ 1 admin staff 16384 11 Jun 2015 Application Support
> drwx------ 1 admin staff 16384 2 Jun 2015 Audio
> drwx------ 1 admin staff 16384 2 Jun 2015 ColorPickers
> drwx------ 1 admin staff 16384 2 Jun 2015 Colors
> <snip>
> 
> I can stop the looping by adding "follow symlinks = no" to smb.conf but even with that added the symlinks are not identified as symlinks.
> 
> Enabling SMB sharing on one of my Macs and connecting from the other (and Windows 10) works perfectly, symlinks are seen for their true nature! (sorry, been looking at this too long)
> 
> It may not be a Samba issue, just trying to work out where to look next.

Windows (not sure about Mac) has no way of discovering
a file/directory is a symlink. They have their own version
of symlinks called 'reparse points' that are not server,
only client followed.

Clients using the SMB1 UNIX extensions (Linux and smbclient
only currently) can see these as symlinks.

I'm planning to implement reparse points in Samba shortly,
as I intend to use reparse points to store symlinks for
the SMB2 UNIX extensions, but depending on whether it needs
VFS changes this might be 4.8.0-only so won't help you
today.

You need to make sure server-side symlinks don't loop,
the clients will see them as nested directories and request
the server to follow them until the OS runs out of recursion
depth and returns errors.

Jeremy.



More information about the samba mailing list