CentOS7 forgotten password and password cracking prevention
method one
1, single-user mode:
Move the cursor to the beginning of the line linux16 added kernel parameters rd.break
Start by ctrl-x
switch_root:/# mount -o remount,rw /sysroot
switch_root:/# chroot /sysroot
switch_root:/# passwd root
switch_root:/# touch /.autorelabel (这一步一定不能少,不然不能重启)
Then restart CTRL-D
Method Two:
1, according to enter the edit mode e
Move the cursor to the beginning of the line linux16, to the init = RW / sysroot / bin / SH (the original is mounted to the operating system / sysroot)
2, the above scheme and then a similar
switch_root:/# chroot /sysroot
switch_root:/# passwd root
switch_root:/# touch /.autorelabel (这一步一定不能少,不然不能重启)
CentOS7 anti password is cracked
That anti someone else to change the password by entering single-user mode
<font color = red> Of course, this method may wish to anti-gentleman villain, CD rescue mode can still change your password </ font>
The solution: add a password for grub can enter single user to verify the stone before grub password
[root@switch ~]# grub2-setpassword
Enter password:
Confirm password:
[root@switch ~]# ls /boot/grub2/
device.map fonts grub.cfg grubenv i386-pc locale user.cfg
[root@switch ~]# cat /boot/grub2/user.cfg
GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.D3D6FC834249606D3B877F6ADE91C1142717374458686755F8EA96EA9B46764349CA6565EF3167456DAF76827BE8E907CAA690D325BBE0EA3A70E8E356DCA57D.F7EB5F673C0739C3F5674BF7D4B0AA2AE18B9D05A4538460E7173D8B09BBF324BF7E9A1B2594C603C2FCDCD3C8FC9D7A4811D6B6FC0C8E27D29618F3EB08E28C
effect:
I found that after pressing e to enter a password
Other methods please Baidu grub2-setpassword
Remove the password method
You can delete /boot/grub2/user.cfg
<font color = red> Of course, this method may wish to anti-gentleman villain, CD rescue mode can still change your password </ font>