Disabling or enabling SSH root login

The Linux systems have a root account by default, which is enabled by default. If unauthorized users get SSH root access to the system, it is not a good idea because this will give an attacker complete access to the system.

We can disable or enable the root login for SSH as per our requirements to prevent the chances of an attacker getting access to the system.

Getting ready

We need two Linux systems to be used as a server and client. On the server system, install the package openssh-server, as shown in the preceding recipe.

How to do it…

First, we will see how to disable SSH root login, and then we will also see how to enable it again:

  1. Firstly, open the main configuration file of SSH, /etc/ssh/sshd_config, in any ...

Get Practical Linux Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.