Port forwarding

# Remote to local
ssh -L local_port:remote_address:remote_port username@server.com
# Local to remote
ssh -R remote_port:local_address:local_port username@server.com

Check key fingerprint

Key fingerprints are logged in /var/log/auth.log. We would like to match fingerprints with key and attached hostname.

ssh-keygen -E <alghoritm> -lf <file>
# e.g :
ssh-keygen -E sha256 -lf ~/.ssh/my-key.pub

# Works on multiline files too
ssh-keygen -E sha256 -lf ~/.ssh/authorized_keys

View login log (not only ssh)

  • use last command
  • you can view failed login attempts with last -f /var/log/btmp and succeessful with last -f /var/log/wtmp