[Samba] Can a macOS (Posix) client see symlinks on FreeBSD server as symlinks on client?
Kees van Vloten
keesvanvloten at gmail.com
Tue Jan 7 20:50:49 UTC 2025
Op 07-01-2025 om 21:36 schreef Jim DeLaHunt via samba:
>
> On 2025-01-07 01:17, Rowland Penny via samba wrote:
>> On Mon, 6 Jan 2025 22:15:57 -0800 Jim DeLaHunt via
>> samba<samba at lists.samba.org> wrote:
>>> 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>
>>>
>> As Apple doesn't use Samba, that isn't Samba code, it is Apples SMB
>> code.
>>
>> That is one of your problems, the Samba code is GPLv3 opensourced, the
>> Apple code is based on old GPLv2 code.
>>
>> Samba tries to be compatible with Apple SMB via various vfs additions,
>> but there are probably always going to be corner cases.
>
> Thank you for pointing this out, Rowland. I realise that my original
> question did not distinguish between the SMB protocol (version 3.1.1),
> the Samba software (version 4.15.13), and the Apple SMB code (whatever
> version it is, and not the same as current Samba software). So really,
> I need to understand answers to three questions:
>
> 1. Does the SMB protocol 3.1.1 permit the representation of symlinks in
> the server filesystem as something which a client could interpret as
> Posix symlinks?
Not by default, the smb3 unix-extension does support it. It will be
stored on the server as a reparse-point and sent over the wire in that
format. A client with smb3 unix-extensions enabled will show it as a
symlink on the client.
> 2. Does the server software (Samba 4.15.13 in my case) send that
> protocol representation when it encounters a Posix symlink in the
> file system?
No.
Even when smb3 unix-extensions are fully implemented in Samba, the Posix
symlinks on the server-side will never be forwarded as symlink to the
client. Symlinks are the cause of many security issue and are therefor
handled with care by Samba.
As stated above the server-side format is the reparse-point, which is
not interpreted as a symlink when you are looking on the server
filesystem locally. This means for users to see it as a symlink when
they are logged on on a server, you have to mount that file-tree over
smb3 on the server as well.
> 3. Does the client software (Apple SMB code from macOS 14.7.2) handle
> that protocol representation and present it as a Posix symlink to
> the client?
>
> Jeremy, thank you for an answer to question 3:
>
> On 2025-01-07 08:57, Jeremy Allison via samba wrote:
>> On Mon, Jan 06, 2025 at 10:15:57PM -0800, Jim DeLaHunt via samba wrote:
>>> …[Elided]…
>>> 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.
>>
>> Apple is not planning to implement the SMB3+POSIX extentions
>> as far as I know. This means they will keep using MFsymlinks
>> against Windows and Samba. "Real" symlinks can be seen as
>> reparse points as this is in the SMB3 protocol but without
>> POSIX extensions they will not be seen as symlinks.
>>
> It sounds like the answer is believed to be "No, and it likely will
> remain No for quite a while". That does clarify things for me.
>
> I would welcome a citation of an official Apple statement about their
> current and planned SMB3 protocol support and POSIX extensions.
> However, there may not be one, I realise that.
>
> It turns out that I have alternatives to SMB on both my server and my
> client. Although Apple is said to have deprecated the AFP protocol for
> file-server access, my server and macOS Sonoma still provides it. So,
> I can revert to connecting to my server via AFP. My server and macOS
> Sonoma also support NFS. NFS has its drawbacks, but it is a
> Posix-friendly protocol, and protocol, server, and client all present
> symbolic links transparently.
>
> Thus I think my way forward is to keep using AFP as long as I can,
> then cut over to NFS, and keep an eye on Apple for a future day when
> they support Posix extensions in the SMB3 protocol, at which point I
> can perhaps come back to Samba.
>
> Thank you all for your help. Best regards,
> —Jim DeLaHunt
>
>
More information about the samba
mailing list