we're running samba and nfs servers on an Ubuntu LTS 04.10 machine. Is there a way detect on the server, whether any client is connected to one of the shares? The clients are Windows 7,Linux or OS X systems.

I would like to know this in order to restart the server without disturbing my users.

Thanks, Kathrin


You can use smbstatus for the Samba shares . It will print a list of users connected with machine, share, etc...

PID     Username      Group         Machine 

  870   username1     Domain Users  machine1       (

  586   username2     Domain Users  machine2       (

With nfs, you can use showmount for a list of machines and mounted shares in the machine:


Hosts on server.domain.com:,machine1.domain.com,machine2.domain.com,machine3.domain.com

Hope it helps.



| improve this answer | |
  • smbstatus is nice. Just wondering why I haven't found it myself. It just does not show mounts done via OS X. But the more important ones are there. With showmount I somehow see more mounts than currently active. So, I need to have a look at the different options. – Kathrin Geilmann Apr 23 '12 at 11:03
  • yes.. showmount shows also the mounts defined in /etc/exports... – Feiticeir0 Apr 23 '12 at 11:10
  • As smbstatus and showmount solves my problems in about 98% of the cases, i have accepted this answer. The remaining 2% will be handled by walking to the corresponding offices. – Kathrin Geilmann Apr 24 '12 at 14:45

You could use netstat -tp | grep smbd to see whether there were any open smbd connections.

tcp        0      0 lo-app-31:microsoft-ds      <ip address of the other machine>:49225 ESTABLISHED 17700/smbd
tcp        0      0 lo-app-31:microsoft-ds      <ip address of the other machine>:49222 ESTABLISHED 27256/smbd

If they are ESTABLISHED then a machine is connected to smbd using TCP.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.