In the startup grub interface, press the up and down keys to select the Linux normal system, press the e key to enter the code editing interface;
Edit the linux16 line and change ro to rw init=/sysroot/bin/sh;
(Recommended tutorial: centos tutorial)
Temporarily change the startup code, boot without mounting the disk, and enter the shell directly: sh ;
Press the ctrl Find the relevant error message:
chroot /sysroot #切换根目录
Open the file and remove the problematic module
vi /var/log/secure #查看日志文件
Comment out the problematic module:
Jan 18 12:10:17 sguap0010 login: PAM adding faulty module: /lib/security/pam_limits.so Jan 18 12:10:20 sguap0010 login: pam_unix(login:session): session opened for user root by LOGIN (uid=0) Jan 18 12:10:21 sguap0010 login: Module is unknown
or
vi /etc/pam.d/login
exit --- Exit bash and return to sh
reboot --- Restart
After entering the system, download the pam_limits.so module file and overwrite /lib/security/pam_limits.so
(64-bit operating system, overwrite /lib64/security/pam_limits.so)
Then
#session required /lib/security/pam_limits.so
uncomment what you just commented out
#session include system-auth
or
vi /etc/pam.d/login
That’s it.
The above is the detailed content of What should I do if I cannot log in despite my correct password in centos7?. For more information, please follow other related articles on the PHP Chinese website!