Disable Root Login on Linux
Posted by Planet Malaysia on February 16, 2007
How to disable root login on Linux system?
There are several ways to do that such as:
1)To prevent users from logging in directly as root, the system administrator can set the root account’s shell to /sbin/nologin in the /etc/passwd file. This will prevent access to the root account through commands that require a shell, such as the su and the ssh commands. Edit the /etc/passwd file and change the shell from /bin/bash to /sbin/nologin.
#vi /etc/passwd ->search for to root and change /bin/bash to /sbin/nologin
2)Create an empty /etc/securetty file to prevents root login on any devices attached to the computer. This file lists all devices the root user is allowed to log into. If the file does not exist at all, the root user can log in through any communication device on the system, whether it by via the console or a raw network interface.
#echo > /etc/securetty
3)To prevent root logins via the SSH protocol, edit the SSH daemon’s configuration file: /etc/ssh/sshd_config. Change the line that says: the /etc/ssh/sshd_config file and set the PermitRootLogin parameter to no.
#vi /etc/ssh/sshd_config PermitRootLogin no
Done.
Possibly Related Posts:
- How to add Dell PERC Drivers into VMware Converter Cold Clone ISO
- Top 10 Free Anti Virus
- Microsoft SQL 2008 Agent not starts
- VMware Workstation 7 Serial Key
- WP Contact Form III – You do not have sufficient permissions to access this page Error
Comments
Leave a Reply