Hello everyone, if you have not used a password to protect the single-user mode, this poses a great risk to your Linux server. Therefore, when it comes to security, it is very important to use a password to protect the single-user mode. This article will show you how to use a password to protect your single-user mode on RHEL/CentOS5.x and RHEL/CentOS6.x. Please execute the given command carefully, otherwise your system will not be able to start normally. First, I will ask you to finish reading it first, and then
Hello everyone, if you have not used a password to protect the single-user mode, this poses a great risk to your Linux server. Therefore, when it comes to security, it is very important to use a password to protect the single-user mode.
This article will show you how to use a password to protect your single-user mode on RHEL/CentOS 5.x and RHEL/CentOS 6. x.
Please execute the given command carefully, otherwise your system will not be able to start normally. First, I will ask you to finish reading and then try. Please bear the relevant consequences by yourself :-)
Password Protect
1. before starting RHEL/CentOS 5. x1.1, back up your/etc/inittab
cp /etc/inittab /etc/inittab.backup
To protect the password in single-user mode, run the following command with root :-
[root@tejas-barot-linux ~]# sed -i '1i su:S:wait:/sbin/sulogin' /etc/inittab
In this way, you will see
su:S:wait:/sbin/sulogin# Default runlevel. The runlevels used by RHS are:# 0 - halt (Do NOT set initdefault to this)# 1 - Single user mode# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)# 3 - Full multiuser mode# 4 - unused# 5 - X11# 6 - reboot (Do NOT set initdefault to this)#id:3:initdefault:
NOTE: If you do not want to use the sed command, you can add "su: S: wait:/sbin/sulogin" to the top of the/etc/inittab"
2. before starting RHEL/CentOS 6. x2.1, back up your/etc/inittab
cp /etc/sysconfig/init /etc/sysconfig/init.backup
2.2 to protect the single-user mode with a password, run the following command with root :-
[root@tejas-barot-linux ~]# sed -i 's/SINGLE=\/sbin\/sushell/SINGLE=\/sbin\/sulogin/' /etc/sysconfig/init
In this way, you will see
SINGLE=/sbin/sulogin
Note:-if you do not want to use sed, you can directly change it to "SINGLE =/sbin/sysconfig/init" in/etc/sysconfig/init"
Enjoy Linux :) enjoy open source
Via: http://www.tejasbarot.com/2014/05/05/disable-password-protect-single-user-mode-rhel-centos-5-x-6-x/
Author: Tejas Barot translator: geekpi proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China