centos 7|CentOS 7 / RHEL 7系统重新设置root密码教程

更新时间:2020-03-23    来源:php安装    手机版     字体:

【www.bbyears.com--php安装】

以前装了centos7的虚拟机为了玩Docker,无奈忘记了当初设置的密码了,网上弄了一圈重置密码信息,记录下.
只知道按e可以进入单个用户模式,无奈centos7启动了grub2模式 要加对应的启动才行

1.第一步重启系统按 e进入编辑模式 GRUB 2

2.第二步 在 rhgb and quiet 的后面添加

init=/bin/sh
selinux=0


root-passwd-2
root-password-3

3.第三步 Remount / root partition , reset root password and autorelable

使用passwd root 修改密码


mount -o remount, rw /
passwd root

NICE 如图成功:
vbox-6

NOTE: In case system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error

Now run the below given command for relabeling the SELINUX

如果前面设置了 selinux=0 这里就不会出现上面错误了
如果有错误继续执行:


touch /.autorelabel

下面重启服务即可

exec /sbin/init

OR

exec /sbin/init
exec /sbin/reboot

本文来源:http://www.bbyears.com/jiaocheng/89033.html

热门标签

更多>>

本类排行