Kees van Vloten
2025-Jan-06 09:49 UTC
[Samba] Can a macOS (Posix) client see symlinks on FreeBSD server as symlinks on client?
Op 06-01-2025 om 10:39 schreef Rowland Penny via samba:> On Sun, 5 Jan 2025 22:43:23 -0800 > Jim DeLaHunt via samba <samba at lists.samba.org> wrote: > >> Hello, Samba folks: >> >> Is there a setting I could invoke, either on my server's Samba >> configuration or on my macOS smbfs configuration, which would make >> the hundreds of legacy symbolic links on the server's Posix file >> system appear as symbolic links on the macOS client? >> >> Does Samba claim that it will present symlinks on the server file >> system as symlinks to a client? >> >> >> Some background: >> >> I have a macOS client which uses files from a small FreeBSD-based >> file server. I just switched from afp to smb as the way of connecting >> to my shares. With afp, my macOS client could create a Posix-style >> symbolic link on the server, and it would be stored as a Posix-style >> symbolic link on the server's file system. My macOS client saw >> symbolic links on the server's file system as symbolic links on the >> shared volume. These links are all internal to the directory trees of >> the share: think `../sibling/child/foo.txt` relative links. >> >> Now, using smb, I don't have that behaviour. It appears that most of >> the symlinks on the server file system, which I created via an afp >> connection, now appear in my macOS clients as directories rather than >> symlinks. >> >> Below is a local symlink, created on my client a year ago, then >> copied to the server via rsync over afp, and which is a symlink on >> the server's file system: >> >> % ls -ld ~/Documents/Projects/2024/@@\ 2023 >> /Volumes/MyShare/Projects/2024/@@\ 2023 >> lrwxr-xr-x 1 jdlh staff???? 7 Dec 30? 2023 >> '/Users/myuser/Projects/2024/@@ 2023' -> ../2023 >> drwx------ 1 jdlh staff 16384 Dec 30? 2023 >> '/Volumes/MyShare/Projects/2024/@@ 2023' >> >> The macOS client view via smb of the FreeBSD symlink is some kind of >> simulated directory (see the "d" in the first column), while it sees >> the symlink on the local filesystem as a symlink (see the "l" in the >> first column, and the arrow pointing to the link path). >> >> Symbolic links which is create via the smb connection to this server >> do appear as symbolic links. On the server file system, they appear >> to be Minshall+French symlinks. They are 1067-byte text files with >> that format. >> >> I have tried reading through the documentation to understand this, >> but I'm having a hard time finding documentation of these details for >> Samba, and the server configuration, and the client configuration. >> >> The server is a TrueNAS version 13 NAS appliance, with FreeBSD OS and >> a ZFS filesystem. It appears to be running smbd Version 4.15.13. The >> global part of the smb4.conf file includes, "unix extensions =? yes". >> I don't see entries for the individual shares, but they must be >> somewhere.? I have checked a box in the admin UI which I think >> invokes "vfs_fruit", but I don't know how to be sure. "sudo >> smbstatus" doesn't seem to say. >> >> The client runs a macOS Sonoma 14.7.2 OS, and Apples "smbfs" variant >> of Samba. `smbutil statshares -m /Volumes/MyShare` prints various >> attributes including, "SMB_VERSION SMB_3.1.1". My understanding is >> that this is plenty modern enough to support Posix well. >> >> As I read the Samba website, especially the wiki, I don't find a page >> that says, "This is the behaviour which Samba provides with regards >> to symlinks."?? There are pages like >> <https://wiki.samba.org/index.php/SMB3-Linux>, which reads to me like >> an implementation design.? There are pages like >> <https://wiki.samba.org/index.php/UNIX_Extensions> which appear to be >> historical, but still show up in search results. Is there somewhere >> some documentation which tells me what the software actually does, >> rather than what it plans to do or used to do? >> >> So: is there a way for me to get Samba server to present Posix >> symlinks to Posix clients as symlinks? >> >> Thank you in advance for your help! >> ???? ?Jim DeLaHunt >> > The problem with symlinks on Samba is that they require 'unix > extensions = yes', which requires SMBv1 (This parameter has been renamed > 'smb1 unix extensions' in the latest versions of Samba) and by default > it is set to 'no'. > > There is ongoing work for the SMBv3 version of 'unix extensions', but > at present (as far as I am aware) there is no support for symlinks and, > from the comments made by one of the Samba devs, it is unlikely to ever > support symlinks, though reparse points are likely.Correct, one addition: on the client side (for linux clients) a reparse point is presented as a symlink. As far as I know that is already available in the linux kernel client, however on the server-side Samba is not ready yet. In the case presented above, there is another unknown, namely how is the implementation in the macOS client regarding symlinks and reparse points? - Kees.> > Rowland >
Jim DeLaHunt
2025-Jan-07 06:15 UTC
[Samba] Can a macOS (Posix) client see symlinks on FreeBSD server as symlinks on client?
On 2025-01-06 01:49, Kees van Vloten via samba wrote:> > Op 06-01-2025 om 10:39 schreef Rowland Penny via samba: >> On Sun, 5 Jan 2025 22:43:23 -0800 >> Jim DeLaHunt via samba <samba at lists.samba.org> wrote: >> >>> Hello, Samba folks: >>> >>> Is there a setting I could invoke, either on my server's Samba >>> configuration or on my macOS smbfs configuration, which would make >>> the hundreds of legacy symbolic links on the server's Posix file >>> system appear as symbolic links on the macOS client? >>> ...[elided]... >>> >> ...[elided]... > > ...[elided]... > In the case presented above, there is another unknown, namely how is > the implementation in the macOS client regarding symlinks and reparse > points?Kees, thank you for the reply. How does the macOS client behave?? That is a great question. I have not found good documentation on the subject. Apple has posted some Samba code publicly at <https://github.com/apple-oss-distributions/smb/blob/main/kernel/smbfs/smbfs_smb.c> and the rest of that repository.? I have not tried to read through it to figure out exactly how it behaves. And, I don't know for sure that the source code there was what was compiled to make the executables on my macOS machine. Best regards, ??? ?Jim DeLaHunt