How to get the history of the ssh connection with the time, like at what time the machine accessed via ssh and by who in Linux/Unix using terminal command?

2 Answers

The command, in a terminal window, journalctl /usr/sbin/sshd will show you log messages like (I am user walt, and just did a ssh localhost):

Feb 04 09:33:54 bat sshd[17129]: pam_ecryptfs: pam_sm_authenticate: /home/walt is already mounted Feb 04 09:33:54 bat sshd[17129]: Accepted password for walt from 127.0.0.1 port 52642 ssh2 Feb 04 09:33:54 bat sshd[17129]: pam_unix(sshd:session): session opened for user walt by (uid=0) 
0

You can try pinky apt install pinky The use is straightforward - just execute pinky in terminal.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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