List of SMB/CIFS Users connected to my Mac

I use a Mac mini as a server to share attached usb drives to various other devices around the house. These are shared as SMB/CIFS shares. How can I find out what users are logged into the SMB/CIFS shares on my Mac mini? Last/Who shows only my user account on the Mac. So I am guessing that there is a Networking command that will meet my needs, but any idea what is the correct command?


Thanks,

Mac mini, macOS 10.13

Posted on Dec 26, 2019 4:02 PM

Reply

Similar questions

3 replies

Dec 27, 2019 1:14 PM in response to Ian Law1

Found something else which may work better (only tested on Linux so you may need to modify the "smbd" part since the command field may be different with macOS):

sudo  lsof  -i  |  awk  '/smbd/  &&  /ESTABLISHED/'



I have noticed on my Linux test system that the username seems to change to root after a period of inactivity on the SMB share.


Here is a modified version of the previous command to filter out just the username & address of the connecting system:

sudo lsof -i |  awk '/smbd/  && /ESTABLISHED/  {printf "%-20s %s\n", $3, $9}'



Dec 26, 2019 8:55 PM in response to Ian Law1

The only thing I can find for macOS is using the following command:

netstat  -na  |  grep  445


If you only want to list incoming connections, then you may be able to filter it using either of these commands (I'm not at a Mac so you may need to modify them as needed since I've only tested using Linux):

netstat  -na  |  grep  445  |  grep  -i  establish


netstat  -na  |  awk  '/445/  &&  /ESTABLISH/'

Dec 27, 2019 8:49 AM in response to HWTech

Hi HWTech,


Thanks for the quick and very helpful response. All the commands work fine, except that they report the IP address of the workstation logged in and not the plain English name associated with that IP address (I guess something like you get when you query the logged in devices to your hub). Oh and the 2 additional commands also worked perfectly too.


I'll keep looking for how I can link the IP to the plain English user name.


Thanks

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

List of SMB/CIFS Users connected to my Mac

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.