14 C
Jaipur
Sunday, November 22, 2020

How to check the sshd Logs on Linux? – Linux Hint

Must read

Google almost made me change my mind about using a Chromebook for business – except for one thing

In the current climate, getting the right hardware to work from home effectively is vital. Having the correct laptop, monitor and accessories can massively...

Black Friday Preview: the all-new Ring Doorbell hits lowest sale price ever

Black Friday officially less than a week away, but Amazon is giving us a preview of the sales event with fantastic device deals that...

The 10 best Amazon Black Friday deals: 4K TVs, Ring Doorbell, Kindle, and more

Amazon Black Friday deals have arrived early this year with record-low prices on 4K TVs, the Ring Doorbell, Kindle, Fire TV devices, and more....

Google Nest Mini and Amazon Echo Dot lead Argos Black Friday deals with massive price cuts

If you're after a cheap smart speaker in this year's Black Friday and Cyber Monday deals, Argos may have you sorted. There are plenty...

sshd stands for Secure SHell Daemon. It is a hidden process that silently listens to all the authentication and login attempts of the Linux operating system. This process starts as soon as you boot your Linux operating system, and it is responsible for enabling secure communication between two entities via an insecure communication channel by establishing a connection between them.

The log file of this daemon is especially helpful if you are trying to figure out any unauthorized login attempts to your system. For doing that, you will have to check the sshd logs on Linux. Therefore, in this article, we will be exploring the two different methods of checking the sshd logs on the Linux operating system.

Note: The following two methods have been demonstrated on Ubuntu 20.04.

Methods of checking the sshd Logs on Linux:

For checking the sshd logs on Ubuntu 20.04, you can make use of any of the following two methods:

Method # 1: Using the “lastlog” command:

This method is useful when you only intend to view the login logs through sshd. This can be done by following the steps described below:

We will be running the “lastlog” command on the terminal for which we will launch it first as shown in the following image:

Now we will run the “lastlog” command in the terminal in the following manner:

The output of this command will display all the login-related logs on your terminal, as shown in the image below:

Method # 2: Viewing the Contents of the “auth.log” File:

This method should be used when you do not want to restrict the sshd logs to the login attempts; rather, you want to check all the sshd logs. You have to follow the steps mentioned below to make use of this method:

We need to access the /var/log/auth.log file for checking all the sshd logs on Ubuntu 20.04. This file can be accessed with the help of the “cat” command in the following manner:

However, if you have not logged in to the root user account, then running this command will render the following error on your Ubuntu 20.04 terminal:

To avoid this error from occurring, you can either try to access this while you are logged in to the root user account or else you can use this command with the “sudo” keyword for having the root user privileges as shown below:

sudo cat /var/log/auth.log

After accessing the auth.log file with the root user privileges, you will be able to see the contents of this file, i.e., all the sshd logs on your Ubuntu 20.04 terminal as shown in the following image:

Conclusion:

In this article, we talked about the two methods of checking sshd logs on Linux. Both of these methods are a very effective means of keeping an eye on all sorts of intrusion activities. Moreover, you can also figure out your latest connection attempts by making use of these methods. The auth.log file is updated every time you attempt to make a new connection, share a file, or try to authenticate yourself.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Google almost made me change my mind about using a Chromebook for business – except for one thing

In the current climate, getting the right hardware to work from home effectively is vital. Having the correct laptop, monitor and accessories can massively...

Black Friday Preview: the all-new Ring Doorbell hits lowest sale price ever

Black Friday officially less than a week away, but Amazon is giving us a preview of the sales event with fantastic device deals that...

The 10 best Amazon Black Friday deals: 4K TVs, Ring Doorbell, Kindle, and more

Amazon Black Friday deals have arrived early this year with record-low prices on 4K TVs, the Ring Doorbell, Kindle, Fire TV devices, and more....

Google Nest Mini and Amazon Echo Dot lead Argos Black Friday deals with massive price cuts

If you're after a cheap smart speaker in this year's Black Friday and Cyber Monday deals, Argos may have you sorted. There are plenty...

5 things to look out for in a cheap phone on Black Friday

If you’re shopping for an affordable phone, it’s a perfect time with all the Black Friday deals going on. And we’ve got a good...