My desktop Mac mini (2018) shares recordsdata to different computer systems on the community. I’ve set it up in System Preferences > Sharing in order that solely identified customers can join, with their username and password.
If I am going to restart my Mini, I typically get a message to say that 1 or extra customers are linked.
Is there a simple solution to discover out which customers are linked?
I used to make use of Server.app, and it could be simple to make use of that (or serveradmin
on the CLI) to find out who was logged in. However since Server has been ‘withdrawn’, it would not appear really easy. I am on Mojave.
final |grep "logged in"
offers:
Ben ttys000 Solar Jun 7 15:24 nonetheless logged in
Ben console Solar Jun 7 15:22 nonetheless logged in
which does not appear to incorporate present AFP linked customers, as urged by the beneficial article. Nor does it give these linked to TM sharing or different connections; nonetheless, these might be gleaned from Exercise Monitor.
netstat -na |grep 139
simply offers me a bunch of IP6 addresses.
tcp6 0 0 fe80::18cf:f908:.51390 fe80::cab:3d08:d.61984 ESTABLISHED
tcp6 0 0 fe80::18cf:f908:.61391 fe80::cab:3d08:d.61898 CLOSE_WAIT
tcp6 0 0 fe80::18cf:f908:.54029 fe80::cab:3d08:d.61394 CLOSE_WAIT
tcp6 0 0 fe80::18cf:f908:.64954 fe80::cab:3d08:d.56139 CLOSE_WAIT
tcp6 0 0 fe80::18cf:f908:.50799 fe80::cab:3d08:d.51394 CLOSE_WAIT
tcp6 0 0 fe80::18cf:f908:.52279 fe80::cab:3d08:d.61394 CLOSE_WAIT
6f249e60a5b12c27 stream 0 0 0 6f249e60a5b1396f 0 0
6f249e60a5b1396f stream 0 0 0 6f249e60a5b12c27 0 0
The most effective I’ve discovered is:
netstat -f inet -n | grep '.548 ' | awk '{ print $5 }' | sed 's/.[^.]*$//'
which provides me IP4 addresses for all connections besides SMB.
Ideally, one thing that lists the connection kind and username could be best, but it surely does appear that that is going to require a script reasonably than a one-liner.