Where to Find SSH Authentication Logs on Ubuntu

Locating and analyzing SSH login attempts is a critical task for maintaining the security of an Ubuntu server. This article explains the exact location of SSH authentication logs on Ubuntu, how to view them using standard command-line tools, and how to filter the log files to identify successful and failed connection attempts.

The Primary SSH Log File: /var/log/auth.log

On Ubuntu systems, the primary location for all authentication-related events, including SSH logins, is the /var/log/auth.log file.

To view this file, you need administrator (sudo) privileges.

Viewing the Log File

You can use standard Linux terminal utilities to read the authentication log.

Filtering for SSH Events

Because the auth.log file records all system authentication events, it is best to filter the results specifically for the SSH daemon (sshd).


Querying Logs with systemd-journald

Modern versions of Ubuntu also record system logs, including SSH events, using the systemd-journald service. You can query these logs directly using the journalctl utility.