Linux – How to list current sshfs mounts to server

linuxloggingsshsshfs

If someone logs into a server via ssh for shell usage, a quick use of last|w|who can be used to show the logged in user. If someone mounts a directory on the same server via sshfs from another computer last|w|who do not show a connection. Is there a command similar to last|w|who which will show current sshfs mounts on a server?

Best Answer

Making an sshfs mount involves connecting across sftp. Hence, what you can do is look for the spawned sftp processes. Assuming the user andreas has made an sshfs mount, or logged in using regular sftp, you'll see something along the following lines:

root@halleck:~# ps aux | grep -i sftp | grep -v grep
andreas  11029  0.0  0.0   2420   648 ?        Ss   23:56   0:00 /usr/lib/openssh/sftp-server
root@halleck:~#

alt.

root@halleck:~# ps aux | grep -i sftp | grep -v grep
andreas  11091  0.0  0.1   9564  1116 ?        Ss   23:57   0:00 sshd: andreas@internal-sftp
root@halleck:~#

What you see depend in what sftp Subsystem you have configured.

The details in this answer assumes OpenSSH server side.