eECHO BLOG

A journey of a thousand miles starts with a single step.

Disable ssh root direct login

For security reasons it is not a good idea to permit ssh root direct login, it is better to login as another user, and then switch to root using the ‘su -’ comand, to do this, you need to disable root from login directly using ssh protocol, this will decrease the possibility of a hacker breaking your linux box, as now he will have to guess your user name and your password

Edit the file

/etc/ssh/sshd_config

vim /etc/ssh/sshd_config

I strongly recommend you to open two logins if doing this from a remote connection, and never close one of them, in case you need to roll back the configuration

Next locate this line “PermitRootLogin yes” by entering this on your vi or vim editor

:/PermitRootLogin yes

and change it to this:

PermitRootLogin no

and save the file, with this:

/etc/init.d/ssh restart

Comments are closed.