When using the mount
command on macOS, I can see mounted network servers like this:
//tt@mynas.local/NAS on /Volumes/NAS (smbfs, nodev, nosuid, mounted by thomas)
In this example "thomas" is my macOS user name, under which I mounted the "NAS" volume.
But there's also the "tt" name before the "@" - and that's what I'm interested in getting - that's the user name known to the server, i.e. the name I logged in on the server when the connection prompt appeared.
How do I get this name (tt) via macOS APIs? I can get it via "mount", but that requires parsing and is inefficient, and so I like to avoid that if possible.
man mount
mentions getfsent()
, but in my testing it only lists internal volumes, not network volumes.