If you are planning to deploy openssh on any server, you must secure it from hackers. There are several programs on internet which can launch a brute force attack against your ssh server. The first step to a secure ssh server is to disable root access via ssh. Brute force attackers often try to guess root password using dictionary attack.
- Open sshd_config file using nano. (You must be root to do this.)
- Scroll down the file until you locate
- Modify PermitRootLogin to
- Save the file by pressing Ctrl-O and exit nano by pressing Ctrl-X.
- Restart SSH with by entering the command below.
sudo nano /etc/ssh/sshd_config
LoginGraceTime 120 PermitRootLogin yes StrictModes yes
PermitRootLogin no
sudo /etc/init.d/ssh restart
After restarting SSH, try to connect using the root account. Access will be denied. However , if you want to access root from a remote machine via ssh, login using a normal user account and use su to become root.






















2 Comments
I unquestionably agree with everything you have stated. Actually, I browsed throughout your additional blogposts and I believe that you are totally correct. Best wishes with this online site.
[...] See original here: Disable root access within OpenSSH on Ubuntu [...]