Ensure that root login is disabled in the SSHD configuration file (sshd_config). Set PermitRootLogin no.
Disabling root login for SSH is a good security practice to enhance the security of your server. By doing this, you prevent direct root logins, forcing users to log in as a regular user and then use sudo
or another privilege escalation method. Here’s how you can disable root login in the SSH configuration file (sshd_config
):
sshd_config
File: Use a text editor, such as nano
or vi
, to edit the sshd_config
file. You may need elevated privileges to modify this file.bashsudo nano /etc/ssh/sshd_config
sudo vi /etc/ssh/sshd_config
PermitRootLogin
Line: Locate the line in the sshd_config
file that begins with PermitRootLogin
. If the line doesn’t exist, you can add it.PermitRootLogin no
nano
, press Ctrl + X
, then Y
to confirm the changes, and finally press Enter
.vi
, press Esc
, then type :wq
and press Enter
.sshd_config
file, restart the SSH service for the changes to take effect.bashsudo service ssh restart
sudo systemctl restart ssh
By setting PermitRootLogin no
, you are disabling direct root logins via SSH. After making this change, make sure that you have another user with administrative privileges who can log in and perform administrative tasks using sudo
.
Always be cautious when editing configuration files, and ensure that you have a way to access your server in case there are any issues. Additionally, consider having a backup of the sshd_config
file before making changes.
The choice between a single AWS hosting instance with multiple cPanel accounts and a single…
Here are some common AWS interview questions and answers: What is AWS? AWS stands for…
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE…
SSL stands for Secure Sockets Layer, which is a security protocol used to establish a…
If you are encountering the "Sorry, you are not allowed to access this page" error…
Building a website that generates 4 million visitors a month is a significant accomplishment and…
This website uses cookies.
Leave a Comment