编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

重置Linux密码(linux重置开机密码)

wxchong 2024-09-01 06:46:40 开源技术 6 ℃ 0 评论
  • If we forget the root password in RHEL7 , How can I recover it ? Is it similar to do as the previous version?
  • How to reset a forgotton root password from the console in Red Hat Enterprise Linux 7?
  • How to redirect the console when using rd.break procedure?
  • 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.

    Tags:

    本文暂时没有评论,来添加一个吧(●'◡'●)

    欢迎 发表评论:

    最近发表
    标签列表