+ Reply to Thread
Results 1 to 1 of 1
-
Administrator
- Join Date
- Mar 2010
- Posts
- 76
To turn off and disable direct root SSH login to the server
To turn off and disable direct root SSH login,
IMPORTANT: Make sure you have another account (preferably belongs to wheel user group too) which is able to login via SSH remotely, and able to SU to root user account. Else you risk been locked out from your server.
1. SSH into server and login as root.
2. Create an user belongs to wheel group
3. In command shell, use vi to edit sshd_config file
vi /etc/ssh/sshd_config
4. From SSH server configuration file and locate a line like below:
#PermitRootLogin yes
5. Uncomment the line by removing the hash symbol (#), and then change the “yes” to “no”. The line should be as
PermitRootLogin no
6. Save the config file. .
7. Restart SSH server
/etc/rc.d/init.d/sshd restart
8. Try to login as root from another shell, it should fail with Access denied error. To access root account, login with your own user name and password, and then su - to root.


LinkBack URL
About LinkBacks



Reply With Quote