Linux OpenSSH server deny root user access / log in

‮ual.www‬tturi.com
Linux OpenSSH server deny root user access / log in

To deny root user access or log in to a Linux system using OpenSSH, you can modify the PermitRootLogin directive in the sshd_config file.

By default, the PermitRootLogin directive is set to yes, which allows root user login using OpenSSH. To disable root user login, you can set the PermitRootLogin directive to no.

Here is an example of how to disable root user login using OpenSSH:

  1. Open the sshd_config file in a text editor:
sudo nano /etc/ssh/sshd_config
  1. Locate the PermitRootLogin directive and set it to no:
PermitRootLogin no
  1. Save the file and exit the text editor.

  2. Restart the OpenSSH server to apply the changes:

sudo systemctl restart ssh

This will disable root user login using OpenSSH. Keep in mind that this will not prevent root user login through other methods, such as local console or serial console login. To disable root user login completely, you will need to take additional measures, such as disabling the root user account or modifying the /etc/securetty file.

It is also important to note that denying root user login using OpenSSH can make it more difficult to perform certain system maintenance tasks, as you will need to log in as a non-root user and use sudo to execute commands with root privileges. Make sure that you have a non-root user with sufficient privileges to perform these tasks before disabling root user login.

Created Time:2017-10-30 10:17:37  Author:lautturi