CentOS7 root密码的重置方式和CentOS 6完全不一样,以进入单用户模式修改root密码为例。
1.重启开机按esc,在第一行按e,进行编辑
@H_301_20@650) this.width=650;" src="http://img.jb51.cc/vcimg/static/loading.png" alt="" style="border:0px;margin:2px 0px;height:auto;" border="0" src="index_files/d25c350a-7c43-4453-a8b4-7be074388480.png">
2.编辑修改两处:ro改为rw,在LANG=en_US.UFT-8后面添加init=/bin/sh
@H_301_20@650) this.width=650;" src="http://img.jb51.cc/vcimg/static/loading.png" alt="" style="border:0px;margin:2px 0px;height:auto;" border="0" src="index_files/11ab5114-0116-4b3d-9377-2ee631c6fc67.png">
3.按Ctrl+X重启,并修改密码
@H_301_20@650) this.width=650;" src="http://img.jb51.cc/vcimg/static/loading.png" alt="" style="border:0px;margin:2px 0px;height:auto;" border="0" src="index_files/2324f389-e416-4bdf-857a-7ab353e44726.png">
4.由于selinux开启着的需要执行以下命令更新系统信息,否则重启之后密码未生效
本处关闭selinux
# vi /etc/sysconfig/selinux
@H_301_20@650) this.width=650;" src="http://img.jb51.cc/vcimg/static/loading.png" alt="" style="border:0px;margin:2px 0px;height:auto;" border="0" src="index_files/c53d5999-d5f7-4099-b741-408ce40f2007.png">
5.重启系统
# exec /sbin/init
@H_301_20@650) this.width=650;" src="http://img.jb51.cc/vcimg/static/loading.png" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" border="0" src="http://ywliyq.blog.51cto.come/u261/themes/default/images/spacer.gif">