who is logged in

See who is on this machine now, who was before, and the failed attempts.

  • users
  • security

Steps

  1. who

    the users logged in now, and from where

  2. w

    the same, with what each one is running

  3. last -n 20

    the last 20 logins

  4. sudo lastb -n 20

    the last 20 failed logins

  5. journalctl -u ssh --since today

    today's ssh logins and attempts (the service is `sshd` on Fedora and Arch)

  6. loginctl list-sessions

    the sessions systemd knows

Notes

  • Many failed logins from one address usually mean someone is guessing passwords: see fail2ban.
  • macOS: who, w and last work the same.

Commands used

  • who
  • w
  • last
  • journalctl

Each has a page in lore: lore who opens it.