How do I publish symlinks as regular files over SMB3? [duplicate]
Unfortunately, this is not how macOS works.
SMB or Server Message Block is a Microsoft Windows technology so it stands to reason that sharing links to SMB shares (or as Microsoft calls them, network shares) is baked into the OS. The UNC share isn't "mounted" like it is in Unix where "everything's a file". In Windows, you can "map" a network drive to a share, but in Unix, you have to mount it.
Finder and SMB
When Finder "sees" the smb://
it invokes the mount_smbfs
command behind the scenes and creates a mount point in the /Volumes/
sub-folder. Using your example, the first time you send the link smb://HAL9000/Video
, it will issue the following command:
`mount_smbfs //domain;user:password@HAL9000/Video /Volumes/Video`
If that name exists, you will get the following path /Volumes/Video(1)
and if that exists, (2)
and so on. Using my SMB mounts on a Synology Diskstation, as another example, I have the share "Network Share" already mounted. When I try to mount again using "Connect to Server" (⌘ CommandK and just connecting directly to the server with no share specified, you can see that it's greyed out.
That's because it's already mounted. Issuing the mount command gives us:
$ mount
/dev/disk2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk5s1 on /Volumes/MUSIC (msdos, local, nodev, nosuid, noowners)
/dev/disk4s2 on /Volumes/My Passport for Mac (hfs, local, nodev, nosuid, journaled)
/dev/disk3s2 on /Volumes/FreeAgent Go (hfs, local, nodev, nosuid, journaled, noowners)
//[email protected]/Network%20Share on /Volumes/Network Share (smbfs, nodev, nosuid, mounted by allan)
The last line confirms it - "Network Share" is already mounted and can't be mounted again.
So why can't I share links?
Because you don't access the file through smb://server-foo/share-bar/filename.txt
(ignoring authentication). You access it by going to /Volumes/Share-bar/filename.txt
The problem with that is /Volumes/Share-name
may be completely different for you and me (see above re: existing names). The only thing you can do is to rewrite the UNC path to let Mac users know which file you're referring to. Example:
Windows: \\HAL9000\Video\GoPro - IMPORT\filename.txt
macOS: /Video/GoPro-Import/filename.txt
The user will then have to manually navigate to that share to get to the file you're referencing.
This is why they created WebDav because now you'll be accessing the file via a universal https://
link which is the same for everyone. The downside is that if you intend to share with Windows clients, you'll need to implement SSL certificates. And yes, Synology does support WebDav