1

How to find out how many clients are connected to my nfs server and their IP or hostname?

2

A quick method, which should work everywhere, is to list all connected sockets to the nfs port via ss on the server:

ss -a | grep nfs

There is also the showmount command:

showmount -a localhost

per manpage:

showmount queries the mount daemon on a remote host for information about the state of the NFS server on that machine. With no options showmount lists the set of clients who are mounting from that host. The output from showmount is designed to appear as though it were processed through ``sort -u''.

Note that there are some caveats to it:

The completeness and accuracy of the information that showmount displays varies according to the NFS server's implementation.

Because showmount sorts and uniqs the output, it is impossible to determine from the output whether a client is mounting the same directory more than once.

So for example, if a client connects multiple times to the same mount, it will appear just once in the showmount output.
In this case with ss -a you should catch them.

| improve this answer | |
0

Since Linux kernel 5.3 you can use special directory called /proc/fs/nfsd/clients.

You can check Kernel version by uname -r command.

| 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.