|
First, Linux forget the root password to enter single-user mode to change the password
(A), on lilo
Linux single prompt, type: 1 in the event of lilo
Screen display lilo: Linux single
2. Enter to enter the Linux command line directly
3. Use the password command to change passwords
(B), about grub
1. grub screen appears, use the arrow keys to select the one that you usually start Linux, and then press e
2. Again using the arrow keys to select the one that you usually start the Linux (like kernel / boot / vmlinuz-2.4.18-14 ro root = LABEL = /), then press e
3. Modify the command line you see now, after adding the number 1 or single:
kernel /boot/vmlinuz-2.4.18-14 single ro root = LABEL = / 1
kernel /boot/vmlinuz-2.4.18-14 single ro root = LABEL = / single
4. Carriage Return, then press the b key to start, you can directly enter the Linux command line
5. Enter directly Enter passwd to change your password by default here is to directly modify the ROOT directly enter the super administrator password, of course, you want to change other user passwords, modify the user name with password is required after PASSWD can.
or
#vi / etc / shadow
The first line, that one line beginning with root root: after the next: the content before deletion,
The first line is similar
root :: ......
Save
#reboot reboot, root password is empty.
(C) use RedHat's first installation CD-ROM, in the event of 'boot:', enter "Linux rescue", then keep pressing Enter until a command prompt, type "chroot / mnt / sysimage" get root permissions, and then enter "password root" change the root password, and then reboot just fine
Second, forbidden to enter single-user mode
If forbidden to enter single-user, we must first configure GRUB password, you only need to modify the /boot/grub/grub.conf or /etc/grub.conf(/etc/grub.conf is /boot/grub/grub.conf symbol link), for example: vi /boot/grub/grub.conf enter the configuration file editing.
Here we describe a method, add a password for grub, increase in single-user mode to prevent others from entering the system has two ways:
1, plaintext
In splashimage this parameter to add the next line: password = password. After saving restart your computer, log on to the GRUB menu when the page will find that this case can not be used directly e command to edit the Startup tab, and must first use the p command, enter the correct password before we can start to edit the label. but we set the password in plain text is not very safe. If someone got the plaintext password can still modify the GRUB boot label to modify the root password.
2, MD5 encryption
In a terminal grub-md5-crypt Enter, then the system will be asked to enter the same password twice, and then the system will output MD5 code. We only need to generate an MD5 cipher text to copy down the parameters in splashimage next line add: password --md5 MD5 cipher text such as: splashimage = (hd0,0) /grub/splash.xpm.gz
password --md5 $ 1 $ xI6vS $ Wi5pi8JyORUNnj3 / 0Yq2 / 0
hiddenmenu
After saving restart your computer, log on to the GRUB menu when the page will find that this case can not be used directly e command to edit the Startup tab, and must first use the p command, enter the correct password before we can start to edit the label. |
|
|
|