Add Security to Linux Server by Disallowing Root Access via SSH
Step 1: SSH into your server.
Step 2: Create second account for SSH. You’ll have to have Super User privileges
$ su -
$ adduser yournewuser
and it will ask you to add a password etc.
Step 3: Probably a good idea to logout of SSH and log back in with your new account, esp if it’s your only other account.
Step 4: Edit ssh_config, also as Super User
$ su -
$ nano /etc/ssh/sshd_config
Find the line for PermitRootLogin and make it look like this:
PermitRootLogin no
Step 5: Restart your SSH server. On Ubuntu, this is recommended by everybody
/etc/init.d/sshd restart
It doesn’t work for me, but this does:
/etc/init.d/ssh restart
Categories: Linux