Security and hardening · Intermediate · 17 min
Spot suspicious logins in the journal and auth log
By Padding · Updated 18 Nov 2026
Ubuntu 26.04.1 LTS · OpenSSH 10.2 · sudo-rs 0.2.13 · wtmpdb 0.75 · Python 3.14
You will read your server's SSH, sudo and login records on Ubuntu 26.04, write a report script that flags the login patterns worth a closer look, and run it every morning with a clear rule for what raises an alert.
On this page
Most break-ins leave a trace in the login records before anything else goes wrong: a password that finally worked after a string of failures, a login at 03:00 from an address nobody recognises, a sudo by an account that never needed one, a new key in authorized_keys. The records are already on your server. The hard part is reading them every day without drowning in the background noise of bots guessing passwords.
In this tutorial you will learn what normal looks like on your own server, read the login records Ubuntu 26.04 keeps (the systemd journal, /var/log/auth.log, last and lastlog2), and write a short Python report that flags five patterns in a journal export. You will test it on a sample export with a planted break-in, add a check for changed SSH keys, and schedule the report with a rule for which findings raise an alert. Everything here reads logs; nothing changes how users log in.
Step 1 · Write down what normal looks like
A login is only suspicious against a picture of what usually happens. Before reading any log, answer four questions for this server and keep the answers: the report script needs them.
- Which addresses do people log in from? An office, a home connection, a VPN or a bastion host.
- Who is meant to use
sudo? - Which accounts belong to services and should never log in interactively?
- When do people normally work?
Start with the address you are connected from now, and the members of the sudo group:
echo "${SSH_CONNECTION:-not connected over SSH}" | cut -d' ' -f1
getent group sudoThe first line is your public address as the server sees it. The second prints something like sudo:x:27:alice,bob; the names after the last colon are the users allowed to run sudo. If a name there surprises you, that is your first finding.
Now list the system accounts that still have a login shell. Accounts with a UID below 1000 belong to the system and to services, and most of them have /usr/sbin/nologin as their shell:
awk -F: '$3 < 1000 && $7 !~ /(nologin|false)$/ {print $1, $7}' /etc/passwdOn a fresh server this prints root /bin/bash and sync /bin/sync, and little else. A service account such as postgres or www-data with a real shell is worth asking about, because it means someone could log in as it.
Make a folder for this work. It will hold exports that contain usernames and addresses, so keep it private:
mkdir -p -m 700 ~/login-watch
cd ~/login-watchCheck it worked
You have a short list written down: your login addresses (with any VPN or office range), the sudo users from getent, the service accounts from /etc/passwd, and your working hours. ls -ld ~/login-watch shows drwx------.
Step 2 · Install the login history tools
Older guides tell you to run last, lastb and lastlog. Those read the binary files /var/log/wtmp, /var/log/btmp and /var/log/lastlog, whose 32-bit timestamps break in 2038. Ubuntu 26.04's util-linux no longer ships any of the three. Their replacements are wtmpdb, which keeps the login history in an SQLite database and provides a new last, and lastlog2, which keeps each user's most recent login. Neither is installed by default, and there is no replacement for lastb: failed logins live in the journal, which you will read in the next step.
Install both, with their PAM modules, which do the recording:
sudo apt-get update
sudo apt-get install -y wtmpdb libpam-wtmpdb lastlog2 libpam-lastlog2wtmpdb comes from the universe component, which is enabled on a standard Ubuntu install. The PAM packages add themselves to /etc/pam.d/common-session, so every SSH or console login from now on is recorded. Earlier logins are not: this history starts today, so the journal stays your main source for the past.
Check it worked
grep -E 'pam_wtmpdb|pam_lastlog2' /etc/pam.d/common-session
sudo last -n 10
sudo lastlog2The grep prints two session optional lines, one per module. last lists recent logins and boots, newest first, with the user, terminal, source address and times; right after installing you may only see a reboot line, and your own logins appear from your next SSH session. lastlog2 prints one row per user with a recorded login: name, time, terminal and remote host. Until the first login after installing, it stops with something like SQL error: no such table: Lastlog2, because the database is only filled in by the first PAM session; log in again over SSH and rerun it.
Use them like this when you investigate:
sudo last -i -s yesterdayshows logins since midnight yesterday with numeric addresses.-salso takes dates such as"2026-11-24 18:00".sudo last deployshows only thedeployuser.sudo lastlog2 -u postgresshows one account. A service account with a recorded login at all deserves a question.
Step 3 · Read SSH and sudo events in the journal
OpenSSH logs every attempt, good or bad, to the journal under the ssh.service unit. Since OpenSSH 9.8 each connection is handled by a separate sshd-session process, so on Ubuntu 26.04 the lines carry sshd-session as their name, not sshd. sudo logs every command it runs under the identifier sudo, whether it is Ubuntu's default sudo-rs or the original sudo.ws.
Read today's SSH results:
sudo journalctl -u ssh.service --since today -g 'Accepted|Failed|Invalid user'You will see three kinds of line. Learn their shapes, because the script matches them:
Accepted publickey for alice from 203.0.113.10 port 50122 ssh2: ED25519 SHA256:...is a successful login. The word afterAcceptedis the method:publickeyorpassword.Failed password for invalid user admin from 198.51.100.7 port 41022 ssh2is a guess at a user that does not exist. On a server with a public address, expect hundreds a day.Failed password for deploy from 192.0.2.66 port 52100 ssh2is a failure against a real account, which matters more.
Read today's sudo use:
sudo journalctl -t sudo --since todayA command that ran looks something like alice : TTY=pts/0 ; PWD=/home/alice ; USER=root ; COMMAND=/usr/bin/apt update: who ran it, as which user, and the full command. A wrong password shows up as a pam_unix(sudo:auth): authentication failure line ending in user=bob.
If rsyslog is installed (it is on a standard Ubuntu Server install), it copies the same authentication messages to /var/log/auth.log. It is plain text, rotated by logrotate, and handy for grep or for copying off the server:
sudo grep -E 'sshd[^:]*: (Accepted|Failed)|sudo(\[[0-9]+\])?: ' /var/log/auth.log | tail -n 20Each line starts with a timestamp something like 2026-11-24T08:02:11.401233+00:00, then the host name and the program.
Export the last seven days of both sources as JSON, one entry per line, for the report script. The ( umask 077; ... ) part creates the file readable only by you:
( umask 077
sudo journalctl -q -u ssh.service -o json --since "7 days ago" > journal-7d.jsonl
sudo journalctl -q -t sudo -o json --since "7 days ago" >> journal-7d.jsonl )Check it worked
wc -l journal-7d.jsonl
head -n 1 journal-7d.jsonl | python3 -m json.tool | grep -E '"(MESSAGE|SYSLOG_IDENTIFIER|__REALTIME_TIMESTAMP)"'wc prints a number of lines above zero on any server that has been online for a day. The second command shows the three fields the script uses: the message text, the program name, and the time in microseconds since 1970.
Step 4 · Write the report script
The script reads a journal export and checks each successful login and each sudo line against your picture of normal. It flags five patterns:
- success-after-failures (HIGH): a login from an address that failed five or more times before it got in. That is what a guessed password looks like.
- service-account-login (HIGH): a login as
root,postgres,www-dataor another service account. - unexpected-sudo (HIGH): a
sudocommand by a user who is not on your list. - new-address (MEDIUM): a login from an address outside your known addresses and networks. Also MEDIUM: a failed
sudopassword. - odd-hours (LOW): a login outside working hours.
Failures with no success afterwards are counted as INFO. They are the bot noise that Fail2ban deals with, and they do not need a person.
Create the script in ~/login-watch. It uses only Python's standard library, and Python 3 is already part of Ubuntu Server:
cat > login-report.py <<'PY'
#!/usr/bin/env python3
"""Flag suspicious SSH logins and sudo use in a journalctl -o json export."""
import argparse
import ipaddress
import json
import re
import sys
from collections import defaultdict
from datetime import datetime, timedelta, timezone
ACCEPTED = re.compile(r"^Accepted (\S+) for (\S+) from (\S+) port \d+")
FAILED = re.compile(r"^Failed \S+ for (?:invalid user )?(\S+) from (\S+) port \d+")
SUDO_RUN = re.compile(r"^\s*(\S+) : .*USER=(\S+) ; COMMAND=(.*)$")
SUDO_FAIL = re.compile(r"^pam_unix\(sudo:auth\): authentication failure;.* user=(\S+)")
RANK = {"HIGH": 0, "MEDIUM": 1, "LOW": 2}
def parse_args():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("export", help="file written by journalctl -o json")
p.add_argument("--known-addresses", default="", help="comma-separated addresses or networks you log in from")
p.add_argument("--sudo-users", default="", help="comma-separated users expected to use sudo")
p.add_argument("--service-accounts", default="root,www-data,postgres,mysql,backup,nobody")
p.add_argument("--work-hours", default="7-20", help="local hours, start-end, e.g. 7-20")
p.add_argument("--utc-offset", type=float, default=0, help="server's local offset from UTC in hours")
p.add_argument("--fail-threshold", type=int, default=5, help="failures before a success that count as a guess")
p.add_argument("--fail-on", choices=["HIGH", "MEDIUM", "LOW"], help="exit 2 if a finding this serious or worse exists")
return p.parse_args()
def as_set(text):
return {item.strip() for item in text.split(",") if item.strip()}
def is_known(addr, networks):
try:
ip = ipaddress.ip_address(addr)
except ValueError: # a host name, if UseDNS is on
return False
return any(ip in net for net in networks)
def read_entries(path, tz):
entries = []
with open(path, encoding="utf-8") as f:
for line in f:
if not line.startswith("{"): # skip blank lines and "-- No entries --"
continue
e = json.loads(line)
msg = e.get("MESSAGE", "")
if isinstance(msg, list): # journald stores non-UTF-8 text as a byte list
msg = bytes(msg).decode("utf-8", "replace")
when = datetime.fromtimestamp(int(e["__REALTIME_TIMESTAMP"]) / 1e6, tz)
entries.append((when, e.get("SYSLOG_IDENTIFIER", ""), msg))
return sorted(entries)
def main():
a = parse_args()
tz = timezone(timedelta(hours=a.utc_offset))
known = [ipaddress.ip_network(n, strict=False) for n in as_set(a.known_addresses)]
sudoers, service = as_set(a.sudo_users), as_set(a.service_accounts)
start, end = (int(h) for h in a.work_hours.split("-"))
findings = []
failures = defaultdict(int) # failed attempts per address since its last success
def flag(level, when, rule, detail):
findings.append((level, when, rule, detail))
for when, ident, msg in read_entries(a.export, tz):
if ident.startswith("sshd"):
if m := FAILED.match(msg):
failures[m.group(2)] += 1
elif m := ACCEPTED.match(msg):
method, user, addr = m.groups()
where = f"user={user} from={addr} method={method}"
if failures[addr] >= a.fail_threshold:
flag("HIGH", when, "success-after-failures", f"{where} after {failures[addr]} failures")
failures[addr] = 0
if user in service:
flag("HIGH", when, "service-account-login", where)
if not is_known(addr, known):
flag("MEDIUM", when, "new-address", where)
if not start <= when.hour < end:
flag("LOW", when, "odd-hours", where)
elif ident == "sudo":
if m := SUDO_FAIL.match(msg):
flag("MEDIUM", when, "sudo-password-failed", f"user={m.group(1)}")
elif "incorrect password" in msg or "NOT in sudoers" in msg:
flag("MEDIUM", when, "sudo-refused", f"user={msg.split(' : ')[0].strip()}")
elif m := SUDO_RUN.match(msg):
user, target, command = m.groups()
if user not in sudoers:
flag("HIGH", when, "unexpected-sudo", f"user={user} as={target} command={command}")
noise = {addr: n for addr, n in failures.items() if n}
findings.sort(key=lambda f: (RANK[f[0]], f[1]))
for level, when, rule, detail in findings:
print(f"{level:<7}{when:%Y-%m-%d %H:%M} {rule:<23}{detail}")
for addr, n in sorted(noise.items(), key=lambda kv: -kv[1]):
print(f"INFO {n} failed logins from {addr} with no success afterwards")
print(f"Findings: {len(findings)}. Addresses with failures only: {len(noise)}.")
if a.fail_on and any(RANK[f[0]] <= RANK[a.fail_on] for f in findings):
sys.exit(2)
if __name__ == "__main__":
main()
PY
chmod 755 login-report.pyTwo details are worth knowing. The failure counter is per address and resets after each success, so one typo before a good login does not count. A sudo line that says incorrect password attempts or NOT in sudoers is reported as sudo-refused rather than as a command that ran. Known addresses accept networks such as 203.0.113.0/28 as well as single addresses, which matters if your connection's address changes: on mobile data in Lagos or Nairobi, carrier-grade NAT can give you a new public address every session, so list your provider's range or log in through a VPN with a fixed address.
Check it worked
python3 login-report.py --help | head -n 3The output starts with usage: login-report.py [-h] and the one-line description. A SyntaxError means part of the heredoc was lost when you pasted it; paste it again.
Step 5 · Test the report on a sample with a planted break-in
Never trust a detector you have not seen fire. This sample export covers two days on a server called web1. Alice and Bob work normally from 203.0.113.10 and 203.0.113.11, a bot guesses at admin, and early on 25 November someone guesses the deploy password from 192.0.2.66, gets in, runs a root shell with sudo and comes back as postgres. All the addresses are from the ranges reserved for documentation.
cat > sample-logins.jsonl <<'JSON'
{"__REALTIME_TIMESTAMP":"1795507331000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Accepted publickey for alice from 203.0.113.10 port 50122 ssh2: ED25519 SHA256:q3XbFh1LkTn0rW6m"}
{"__REALTIME_TIMESTAMP":"1795507540000000","SYSLOG_IDENTIFIER":"sudo","MESSAGE":"alice : TTY=pts/0 ; PWD=/home/alice ; USER=root ; COMMAND=/usr/bin/apt update"}
{"__REALTIME_TIMESTAMP":"1795512601000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Invalid user admin from 198.51.100.7 port 41022"}
{"__REALTIME_TIMESTAMP":"1795512603000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for invalid user admin from 198.51.100.7 port 41022 ssh2"}
{"__REALTIME_TIMESTAMP":"1795512609000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for invalid user admin from 198.51.100.7 port 41030 ssh2"}
{"__REALTIME_TIMESTAMP":"1795512615000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for invalid user oracle from 198.51.100.7 port 41044 ssh2"}
{"__REALTIME_TIMESTAMP":"1795525852000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Accepted publickey for bob from 203.0.113.11 port 60331 ssh2: ED25519 SHA256:Zk82mVYcPq4sLd0e"}
{"__REALTIME_TIMESTAMP":"1795525950000000","SYSLOG_IDENTIFIER":"sudo","MESSAGE":"pam_unix(sudo:auth): authentication failure; logname=bob uid=1001 euid=0 tty=/dev/pts/1 ruser=bob rhost= user=bob"}
{"__REALTIME_TIMESTAMP":"1795560607000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Accepted publickey for bob from 203.0.113.11 port 60802 ssh2: ED25519 SHA256:Zk82mVYcPq4sLd0e"}
{"__REALTIME_TIMESTAMP":"1795574461000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for deploy from 192.0.2.66 port 52100 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574464000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for deploy from 192.0.2.66 port 52101 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574469000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for deploy from 192.0.2.66 port 52102 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574475000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for deploy from 192.0.2.66 port 52103 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574482000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for deploy from 192.0.2.66 port 52104 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574490000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Failed password for deploy from 192.0.2.66 port 52105 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574525000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Accepted password for deploy from 192.0.2.66 port 52107 ssh2"}
{"__REALTIME_TIMESTAMP":"1795574598000000","SYSLOG_IDENTIFIER":"sudo","MESSAGE":"deploy : TTY=pts/2 ; PWD=/home/deploy ; USER=root ; COMMAND=/usr/bin/bash"}
{"__REALTIME_TIMESTAMP":"1795576544000000","SYSLOG_IDENTIFIER":"sshd-session","MESSAGE":"Accepted publickey for postgres from 192.0.2.66 port 52190 ssh2: RSA SHA256:b7Hq0aTn2xWm9cLp"}
JSONRun the report with Alice and Bob's addresses and the sudo users from the first step:
python3 login-report.py sample-logins.jsonl \
--known-addresses 203.0.113.10,203.0.113.11 \
--sudo-users alice,bobCheck it worked
The report prints the HIGH findings first:
HIGH 2026-11-25 02:42 success-after-failures user=deploy from=192.0.2.66 method=password after 6 failures
HIGH 2026-11-25 02:43 unexpected-sudo user=deploy as=root command=/usr/bin/bash
HIGH 2026-11-25 03:15 service-account-login user=postgres from=192.0.2.66 method=publickey
MEDIUM 2026-11-24 13:12 sudo-password-failed user=bob
MEDIUM 2026-11-25 02:42 new-address user=deploy from=192.0.2.66 method=password
MEDIUM 2026-11-25 03:15 new-address user=postgres from=192.0.2.66 method=publickey
LOW 2026-11-24 22:50 odd-hours user=bob from=203.0.113.11 method=publickey
LOW 2026-11-25 02:42 odd-hours user=deploy from=192.0.2.66 method=password
LOW 2026-11-25 03:15 odd-hours user=postgres from=192.0.2.66 method=publickey
INFO 3 failed logins from 198.51.100.7 with no success afterwards
Findings: 9. Addresses with failures only: 1.Read it the way an analyst would. The three HIGH lines tell one story from one address in 33 minutes. Alice's morning login and her sudo apt update do not appear at all, which is the point: normal activity stays out of the report. Bob's late login from his usual address is only LOW.
Times are in UTC unless you pass --utc-offset. Check your server's offset with date +%z; for a server set to West Africa Time it is +0100, so pass --utc-offset 1.
Now point the report at your own export from the earlier step, with your real addresses and the sudo users from getent:
python3 login-report.py journal-7d.jsonl \
--known-addresses 203.0.113.10,203.0.113.11 \
--sudo-users "$(getent group sudo | cut -d: -f4)"Replace the two addresses with your own. A clean week shows only INFO lines and LOW lines you can explain.
Step 6 · Check authorized_keys for new keys
An attacker who gets in once usually adds an SSH key, so they no longer need the password. That leaves no trace in the login lines until they use it. Record the keys every account trusts now, as a baseline. The loop runs inside sudo sh -c, so it can read every home folder:
sudo sh -c 'for f in /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys; do
[ -f "$f" ] && ssh-keygen -lf "$f" | sed "s|^|$f |"
done' > keys-baseline.txt
cat keys-baseline.txtEach line is the file, the key size, its SHA256 fingerprint, the comment and the key type, something like /home/alice/.ssh/authorized_keys 256 SHA256:... alice@laptop (ED25519). Go through it once and make sure you know every key. Remove any you cannot account for from the account's authorized_keys file, after checking with its owner.
Later, take the same snapshot and compare it with the baseline:
sudo sh -c 'for f in /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys; do
[ -f "$f" ] && ssh-keygen -lf "$f" | sed "s|^|$f |"
done' > keys-now.txt
if diff keys-baseline.txt keys-now.txt; then echo "No key changes"; fiTo see which files changed in the last week, whatever is in them, use find:
sudo find /root /home -name authorized_keys -mtime -7 -lsCheck it worked
When nothing has changed, diff prints nothing and you see No key changes. A line starting with > is a key that was added since the baseline, and < is one that was removed. For a key nobody can explain, treat the account as compromised: follow /tutorials/collect-evidence-from-a-linux-server-after-a-suspected-breach before you delete anything, so the evidence survives.
Step 7 · Decide what raises an alert and run it daily
A report nobody reads is the same as no report, and one that alerts on every bot is soon ignored. Use the levels like this:
- HIGH: act today. Send it where someone will see it within hours. Before you treat it as an incident, ask the person whose account it is. "Was that you at 02:42?" settles most cases in a minute, and the script only tells you what the log says, not who was at the keyboard.
- MEDIUM: review the same day. New addresses are often travel, a new phone or a changed mobile data address. When you confirm one, add it, or its network, to the known list so it stops showing.
- LOW: read weekly. If odd-hours lines are always the same person, change
--work-hoursrather than ignoring the rule. - INFO: no action. Fail2ban handles repeated failures. A sudden jump in the count is worth a look at your firewall and SSH settings.
Install the script where root can run it, with a wrapper that exports the last 24 hours, writes a dated report and logs a warning when there is a HIGH finding. Replace the two addresses on the KNOWN= line with your own, and set UTC_OFFSET to your server's offset so the odd-hours rule uses local time (add --work-hours to the command too if your hours are not 07:00 to 20:00):
sudo install -d -m 755 /usr/local/lib/login-watch
sudo install -m 755 ~/login-watch/login-report.py /usr/local/lib/login-watch/
sudo install -d -m 750 /var/log/login-watch
sudo tee /usr/local/sbin/login-watch > /dev/null <<'SH'
#!/bin/bash
# Daily login report. Replace the addresses on the KNOWN line with your own.
set -euo pipefail
KNOWN=203.0.113.10,203.0.113.11
UTC_OFFSET=0 # replace with your server's offset in hours, from date +%z (West Africa Time: 1)
SUDO_USERS=$(getent group sudo | cut -d: -f4)
umask 077
report=/var/log/login-watch/$(date +%F).txt
export_file=$(mktemp)
trap 'rm -f "$export_file"' EXIT
journalctl -q -u ssh.service -o json --since "24 hours ago" > "$export_file"
journalctl -q -t sudo -o json --since "24 hours ago" >> "$export_file"
if ! /usr/local/lib/login-watch/login-report.py "$export_file" \
--known-addresses "$KNOWN" --sudo-users "$SUDO_USERS" \
--utc-offset "$UTC_OFFSET" --fail-on HIGH > "$report"; then
logger -p auth.warning -t login-watch "HIGH login findings: see $report"
fi
SH
sudo chmod 755 /usr/local/sbin/login-watchThe --fail-on HIGH option makes the script exit with status 2 when it finds anything HIGH, and the wrapper turns that into a login-watch warning in the journal. Hook that warning into whatever already reaches your phone, such as the alerting in /tutorials/log-security-events-an-analyst-can-use. If you send reports by email or chat, keep any webhook token in a root-only file, not in this script.
Run it every morning at 07:15 with a systemd timer. Persistent=true runs a missed report after the server was off:
sudo tee /etc/systemd/system/login-watch.service > /dev/null <<'UNIT'
[Unit]
Description=Daily report of suspicious logins
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/login-watch
UNIT
sudo tee /etc/systemd/system/login-watch.timer > /dev/null <<'UNIT'
[Unit]
Description=Run the login report every morning
[Timer]
OnCalendar=*-*-* 07:15:00
Persistent=true
[Install]
WantedBy=timers.target
UNITsudo systemctl daemon-reload
sudo systemctl enable --now login-watch.timer
sudo systemctl start login-watch.serviceCheck it worked
systemctl list-timers login-watch.timer
sudo cat /var/log/login-watch/$(date +%F).txt
sudo journalctl -t login-watch --since todaylist-timers shows the next run at 07:15. Today's report ends with the Findings: line. If it is empty apart from that line, either nothing happened or the export found no entries: sudo journalctl -u ssh.service --since "24 hours ago" | head tells you which. The last command shows a warning only if there was a HIGH finding.
sudo ls -l /var/log/login-watch/The folder holds one .txt report per day, readable only by root.
Next steps
- Stop the bot noise before it reaches the report: /tutorials/block-brute-force-logins-with-fail2ban.
- Remove the patterns this report catches at the source, with key-only logins and no root over SSH: /tutorials/harden-ssh-on-ubuntu-26-04.
- Search the journal with more filters when a finding needs context: /tutorials/search-the-systemd-journal-with-journalctl.
- Know what to do when a HIGH finding turns out to be real: /tutorials/collect-evidence-from-a-linux-server-after-a-suspected-breach.
Related tutorials
- Write custom Fail2ban jails and filters for your own appsYou will have Fail2ban 1.1 banning repeated failed sign-ins to your own app and to an nginx basic-auth area, with filters you tested against sample logs, your own addresses allow-listed, and longer bans for repeat offenders.
- Validate file uploads before you store or serve themYou will take a FastAPI image upload route that trusts everything the browser sends, prove its flaws with pytest, and rebuild it with size limits, type checks from the file's own bytes, Pillow re-encoding, random storage names and safe download headers.
- Use SSH certificates instead of copying keys to every serverYou will run a small SSH certificate authority with ssh-keygen, log in to an Ubuntu 26.04 server with an eight-hour user certificate, give the server a host certificate so clients stop asking about fingerprints, and revoke a certificate the server then refuses.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials