Linux Labs

Bash: text processing and scripts / Stage 1 of 9

Regular expressions in grep

Not running Starting usually ~20 s
Leave the lesson

Step 5 of 6 · on a machine · 5 min

Who is guessing passwords

Another log and another question — this time you build the pattern yourself.

Overnight someone was trying passwords against SSH. A firewall rule needs a list of the addresses that made failed login attempts: just the addresses, each one once. The SSH server recorded those attempts in auth.log as Failed password lines. Successful logins and dropped connections are there too, from other addresses, but they do not belong on the list.

Exercise · do it

Collect the failed login addresses

In ~/grep-lab, write to bad-ips.txt the addresses that made failed password login attempts according to auth.log — one address per line, no repeats.

Sign in and start The machine is available after signing in

Goals · 0 of 2

  • Write only addresses to bad-ips.txt, one per line not done yet
  • Collect the failed login addresses without repeats not done yet

Step goals

0 of 2
  • Write only addresses to bad-ips.txt, one per line — not done yet
  • Collect the failed login addresses without repeats — not done yet
Ubuntu 24.04

Step goals

0 of 2
  • Write only addresses to bad-ips.txt, one per line — not done yet
  • Collect the failed login addresses without repeats — not done yet
Loading…