CentOS7--修改密码


修改timeout

[root@localhost Desktop]# vi /etc/default/grub 
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

:wq

生成信息的grub配置文件

[root@localhost Desktop]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-079fa89c5edb45acb20a66788875fc67
Found initrd image: /boot/initramfs-0-rescue-079fa89c5edb45acb20a66788875fc67.img
done
[root@localhost Desktop]#

设置明文的grub密码

[root@localhost Desktop]# vi /etc/grub.d/00_header 

        timeout="${2}"
        style="menu"
    fi
    cat << EOF
if [ x\$feature_timeout_style = xy ] ; then
  set timeout_style=${style}
  set timeout=${timeout}
EOF
    if [ "x${style}" = "xmenu" ] ; then
        cat << EOF
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=${timeout}
EOF
    else
        cat << EOF
# Fallback hidden-timeout code in case the timeout_style feature is
# unavailable.
elif sleep${verbose} --interruptible ${timeout} ; then
  set timeout=0
EOF
    fi
    cat << EOF
fi
EOF
}

if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
    cat <

给grub设置完密码后,生成新的grub配置文件

[root@localhost Desktop]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-079fa89c5edb45acb20a66788875fc67
Found initrd image: /boot/initramfs-0-rescue-079fa89c5edb45acb20a66788875fc67.img
done
[root@localhost Desktop]# reboot

输入grub密码

输入grub密码后进入的界面

破解root密码

ctrl+x之后进入的界面

重新设定密码

设定密码之后重启


results matching ""

    No results matching ""