1、重启操作系统,reboot;2、按任意键打断启动引导;,我来为大家讲解一下关于linux重新设置密码?跟着小编一起来看一看吧!
linux重新设置密码
1、重启操作系统,reboot;
2、按任意键打断启动引导;
3、按e编辑,找到 linux16 ;
linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=480d378c-1579-4ecf-9689-3b25dbd977c5 ro crashkernel=auto rd.lvm.lv=rhel_dhcp-192-83/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=rhel_dhcp-192-83/root rhgb quiet
initrd16 /initramfs-3.10.0-123.el7.x86_64.img
4、修改成如下样子:
linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=480d378c-1579-4ecf-9689-3b25dbd977c5 ro crashkernel=auto rd.lvm.lv=rhel_dhcp-192-83/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=rhel_dhcp-192-83/root rhgb quiet rd.break
initrd16 /initramfs-3.10.0-123.el7.x86_64.img
5、按Ctrl x重启操作系统
6、Remount /sysroot as read-write
switch_root:/# mount -oremount,rw /sysroot
switch_root:/# chroot /sysroot
7、修改密码
sh-4.2# echo redhat | passwd --stdin root
sh-4.2# touch /.autorelabel
Type exit twice. The first will exit the chroot jail, and the second will exit the initramfs debug shell.Then the OS will reboot, you can input the new password for the root user.
,