PDA

View Full Version : [ubuntu] View incoming ssh and sftp connections



futileissue
July 14th, 2008, 04:40 PM
Sorry in advance if this is posted elsewhere, I did numerous searches and couldn't find anything relevant. Also checked manpages for answers and found nothing.

I'm running an openssh server on my Ubuntu 8.04 machine. (just for easy access to my files elsewhere). Is there an easy way to view all currently active ssh/sftp connections? I would like to see who's logged on, and if possible details about their actions.

Thank you.

Vivaldi Gloria
July 14th, 2008, 09:24 PM
Sorry in advance if this is posted elsewhere, I did numerous searches and couldn't find anything relevant. Also checked manpages for answers and found nothing.

I'm running an openssh server on my Ubuntu 8.04 machine. (just for easy access to my files elsewhere). Is there an easy way to view all currently active ssh/sftp connections? I would like to see who's logged on, and if possible details about their actions.

Thank you.

See /var/log/auth.log and try the command "netstat". Read


man netstat

These will show you login attempts and active connections. I don't know how you can log their actions.

futileissue
July 14th, 2008, 09:28 PM
Thanks. I think after some research I've discovered that sftp with openssh simply does not support any realistic way to accurately log actions.

daleus
July 14th, 2008, 11:32 PM
you can try "watch who" in a terminal, which will show you who is logged in (from where, IP etc, or if they're local with their tty) it updates every 2 seconds, I use it to keep SSH alive (SSH keepalive doesn't work against corporate firewall used here)

IanUK
March 11th, 2013, 02:53 PM
Try -

grep sshd:session /var/log/auth.log | tail -1 | awk '{print $8}'

Will return "opened" or "closed" or nothing if no sessions ever used.

oldos2er
March 11th, 2013, 06:55 PM
Old thread closed, please don't bump old threads.