Hi,
Is it possible to get the name of the user that is connected to a specific volume?
I work at a company where every employee has a specific login for our servers.
I am looking to add the connected user’s name to the log the is written by a script that we use.
Thanks for the help.
Mount will give you the user who mounted the volume.
So something like this will work
set theVolume to "/Volumes/SharePoint"
--Check if the volume is mounted first
set regEx to " on " & theVolume & " "
set mountedVolumes to do shell script "mount"
if regEx is not in mountedVolumes then
return false --volume is not mounted
end if
--check which user has mounter the volume
set userMountedVolume to text 1 thru -2 of (do shell script "mount | grep " & quoted form of regEx & " | awk -F ' mounted by ' '{print $2}'")
I love the terminal and grep approach, but unfortunately “mount” returns the user that is logged into the computer that mounted the volume. In other words, it returns the same information as the “whoami” command.
We are in a situation where people move around to different computers, so I’m trying to gather the “Name:” portion of the Name and Password credentials that a user entered in order to log on to the server volume.
This may not actually be possible from the client side of the server, but I thought that I would throw it out there to the community to see if anyone has any ideas.
Thanks again!