Raspberry Pi

How to Check the sshd Logs on Raspberry Pi

Secure Shell Daemon, commonly referred to as sshd, is a process that checks the login attempts performed by the users to access a system. This process starts automatically whenever you start your system. The sshd feature is crucial as this will keep a check on authorized and unauthorized login sessions on your system.

If you want to check these sshd logs on your Raspberry Pi system, you should follow this article that provides ways to check for the logs on Raspberry Pi. So, without delay, let’s move straight toward the main process.

How to Check the sshd Logs on Raspberry Pi

There are generally two methods to check the sshd logs on Linux and you can apply those methods in your Raspberry Pi OS to check the login attempts.

Method 1: Check sshd Logs through lastlog Command

The lastlog command provides you with the logs sessions on your Raspberry Pi system and you can execute this command to check the sshd log easily on your Raspberry Pi terminal.

$ lastlog

The output provided may be different in your case since we have only logged in from the pi user.

Method 2: Check the Logs through auth.log File

The auth.log file on your system also includes the sshd logs information as it provides detailed information about the login attempt performed on your Raspberry Pi system. You can run this file on the Raspberry Pi system through the “cat” command to see the sshd logs on the terminal.

$ cat /var/log/auth.log

In case you have difficulty running the above command for permission denied error, you can run the same command with the root user using “sudo”.

Conclusion

Exploring the login attempts on the Raspberry Pi system is beneficial for your device security because you can keep a check on the unauthorized login attempts made to your system. The above two methods are crucial to help you check the sshd logs on your Raspberry Pi system. You can use the “lastlog” command or retrieve the sshd logs information from the auth.log file. Both methods are useful to check for authorized and unauthorized login attempts on your Raspberry Pi system.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.