Event start:
Earlier in the year, some minor problems occurred while configuring Tomcat and java environment variables. Later, due to several misoperations, the machine was stuck there after a logout. Then, press the power key to force the shutdown. However, after you log on as an ordinary user after restarting, you will find that you cannot log on after you enter the correct password. Incorrect password prompt
My attempt:
Install the installation disc in the optical drive, restart it, and enter the shell in rescue mode. Since I use the Linux version of fedora 14, run the following command after entering the shell to obtain the root permission:
$ Chroot/mnt/sysimage
Run the following command in the vi Editor:
$ Vi/etc/profile
In the first line or the line of the word headed by your root, delete the string between the second colon and the third colon, and save and exit (Press Esc, press the colon, enter wq, press ENTER)
$ Passwd root # enter the password twice and prompt that the password is successfully modified.
After restarting, log on to the terminal with a common su command, but still cannot log on with the correct password.
The solution is as follows:
After you use the installation disc to enter the shell, use the method mentioned above to obtain the root permission, add a user, and modify the line starting with the new username in the/etc/profile file, the two parameters used to identify a user group are changed to the same parameter (0: 0) as the root user, and the account super user permission is granted.
View passw and shadow permissions under/etc.
$ Ls-l/etc/{passwd, shadow}
-Rw ------- 1 root 2434 03-05 19:52/etc/passwd
-Rw ------- 1 root 1700 03-06/etc/shadow
Common users are not allowed to read passwd files. Then modify the passwd permission:
$ Chmod 644/etc/passwd
Error cause:
Yes, the/bin/su file is canceled with the s bit, so the solution is chmod a + s/bin/su.
# Ls-l/bin/su
-Rwxr-xr-x 1 root 39948 03-05 14:38/bin/su
# Chmod a + s/bin/su
# Ls-l/bin/su
-Rwsr-sr-x 1 root 39948 03-05 14:38/bin/su
Log on to the root again to solve the problem.
This article is from the "Michael_Feng" blog