SSH-LAST(1) User Commands SSH-LAST(1) (NAME) ssh-last - SSH (SYNOPSIS) ssh-last [OPTIONS] ssh_logs | ssh-last [OPTIONS] (OPTIONS) -a ( 'ignored' ) -c ( SSH) -d (debug) -f ( 'known') -h -i ( 'known' -f ) -l journalctl ( ) -n /IP ( 'known') -w SSH -? ( perl-doc ) --version (EXAMPLES) ssh-last ssh-last -c | more ssh-last -c | less -R # less ssh-last -cw # LC_TIME=C journalctl _COMM=sshd -g 'Accepted|Disconnected' --since yesterday | ssh-last # LC_TIME=C journalctl _COMM=sshd -g 'Accepted|Disconnected' --since -3d --until -2d | ssh-last # LC_TIME=C journalctl _COMM=sshd -g 'Accepted|Disconnected' --since -1h | ssh-last # LC_TIME=C journalctl _COMM=sshd -g 'Accepted|Disconnected' --until "2022-03-12 07:00:00" | ssh-last # ( ) zgrep -hE 'Accepted|Disconnected' auth.log.2.gz auth.log.1 auth.log | ssh-last zgrep -hE 'Accepted|Disconnected' $(ls /var/log/auth.log* --sort=time --reverse) | ssh-last zgrep -hE 'Accepted|Disconnected' $(ls /var/log/messages* --sort=time --reverse) | ssh-last zgrep -hE 'Accepted|Disconnected' $(ls /var/log/secure* --sort=time --reverse) | ssh-last (DESCRIPTION) ssh-last last SSH . (Output Flags) +--------------------------------------------------------------------------+ | | | AUTH_ID | | | | (C) sshd authorized login via (c)ertificate | | (K) sshd authorized login via public (k)ey | | (?) sshd authorized login via some other type (password, pam) | | | +--------------------------------------------------------------------------+ (Algorithm) sshd : ) (Accepted) (Disconnected). ) username auth_type fingerprint ... ) ) /etc/os-release ... (FILES) (Ignored) /etc/ssh-tools/ssh-last/ignored ~/.config/ssh-tools/ssh-last/ignored ./ignored -a +--------------------------------------------------------------------------+ |# Fingerprints | | | |SHA256:ElgyEn5xPe4VlK5jJkqauRdAKNRHdh2tGHfo0m9/IwW Jenkins | |SHA256:5xPe4JkqaElKNRHGHfxPe4RdAKdh2tlK5AKNRHn5xK5 foo # comment | |SHA256:nmKL5s7/fs45312nvjhFSRTREa44r2hfgJHJG54353R bar@gmx.de | | | |# Hosts | | | |127.0.0.1 localhost # local ssh logins | |192.168.1.50 nas # more comments | |webserver # alias from the 'known' file | | | |# Cert IDs | | | |user1@company.com | |user2@company.com with some info | |user3@company.com with some info # and a comment | | | |# Users | | | |git # gitlab | +--------------------------------------------------------------------------+ (Known) /etc/ssh-tools/ssh-last/known ~/.config/ssh-tools/ssh-last/known ./known -f () -n () -i ( ) +--------------------------------------------------------------------------+ |# Fingerprints | | | |SHA256:WwI/9m0ofHGt2hdHRNKAdRuaqkJj5KlV4ePx5nEyglE Sven Wick | |SHA256:xyk5ZZZWZKnmKL5mYdk8Poy5eds7/CD/JEwqykMnlQQ root@n40l # comment | |SHA256:G7h9i5+NDU72Ae40gCkxyvDz/8BH+KETw7sXHCYr5w0 sven.wick@gmx.de | | | |# Hosts | | | |127.0.0.1 localhost # local ssh logins | |192.168.1.50 nas # more comments | |192.168.50.100 webserver | | | |# Cert IDs | | | |user1@company.com vaporup | +--------------------------------------------------------------------------+ (BUGS AND LIMITATIONS) (JumpHosts) JumpHost ProxyCommand ProxyJump LOGOUT DURATION . (Unprivileged users) ssh-last (root) sudo ) systemd ) ssh-last -w root ss netstat ) ssh-last authorized_keys (OS Upgrades) (in-place) dist-upgrade Debian/Ubuntu sshd ssh-last (Log inconsistency) "Disconnect" sshd systemd /var/log/auth.log . ssh-last systemd ssh-last journald (NOTES) (Helper Scripts) my-ssh-last +--------------------------------------------------------------------------+ | #!/usr/bin/env bash | | | | LC_TIME=C journalctl _COMM=sshd --since -1week \ | | | grep -E 'Accepted|Disconnected' \ | | | ssh-last "$@" | | | +--------------------------------------------------------------------------+ (SEE ALSO) ssh-keyinfo(1), ssh-certinfo(1) (AUTHOR) Sven Wick SSH-TOOLS 2024-09-26 SSH-LAST(1)