Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

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.

share|improve this answer
    
Thanks Andol, this is the method that I currently use. I know that I could alias this type of a command and use the alias quickly. I was wondering if there were any widely used utils out there that had this type of listing built into it. –  M. Smith Jul 13 '12 at 0:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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