1.Reboot the system.(重启当前Linux操作系统)
2.Interrupt the boot loader count down by pressing anykey.
3.Move the cursor to the entry that needs to be booted.
4.Press “e” to edit the select edentry.(在下列界面中,按e键进入编辑界面)
5.Move the cursor to the kernel command line(the line that start swith linux16.(寻找Linux16开头的内容所在行)
6.Append rd.break.(追加rd.break,如下图所示)
7.Press Ctrl+x to start.(ctrl+x开始执行操作)
8.Remount /sysroot as read-write.(取消/sysroot的只读挂载)
switch_root:/# mount -o remount,rw /sysroot(此命令是以读写的形式重新挂载/sysroot)
9.Switch into a chroot jail, where /sysroot is treated as the root of the filesystem tree
switch_root:/# chroot /sysroot(此程序标识更改程序执行时所参考的根目录)
10.Set a new root password:(对管理员用户设置新的密码,)
sh-4.2# passwd [root] (change the root password)(对root用户设置新密码)
or或
sh-4.2# passwd -d root (delete the root password)(直接删除root用户的密码,进行无密码登录,进入系统后可以再根据passwd命令完成对root用户的密码设置)
11.Make sure that all unlabeled files (including/etc/shadow at this point)get relabeled during boot.
sh-4.2# touch /.autorelabel(创建安全标签文件,这是对SELinux相应的设置,设置完成后,你将在安全的Linux环境下工作,如果这块未设置的话将重启失败)
12.sh-4.2# exit
13. switch_root:/# exit(通过exit命名退出编辑界面后,系统自动重新启动)