[Samba] Can a macOS (Posix) client see symlinks on FreeBSD server as symlinks on client?
Jim DeLaHunt
list+samba at jdlh.com
Mon Jan 6 06:43:23 UTC 2025
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
--
. --Jim DeLaHunt, jdlh at jdlh.com http://blog.jdlh.com/ (http://jdlh.com/)
multilingual websites consultant, Vancouver, B.C., Canada
More information about the samba
mailing list