• Start the system and, on the GRUB 2 boot screen, press the e key for edit.
  • Remove the rhgb and quiet parameters from the end, or near the end, of the linux16 line, or linuxefi on UEFI systems.

    Press Ctrl+a and Ctrl+e to jump to the start and end of the line, respectively. On some systems, Home and End might also work.

IMPORTANT

The rhgb and quiet parameters must be removed in order to enable system messages.

  • Add the following parameters at the end of the linux line on 64-Bit IBM Power Series, the linux16 line on x86-64 BIOS-based systems, or the linuxefi line on UEFI systems:

rd.break enforcing=0

Adding the enforcing=0 option enables omitting the time consuming SELinux relabeling process.

The initramfs will stop before passing control to the Linux kernel, enabling you to work with the root file system.

Note that the initramfs prompt will appear on the last console specified on the Linux line

  • Press Ctrl+x to boot the system with the changed parameters.

    With an encrypted file system, a password is required at this point. However the password prompt might not appear as it is obscured by logging messages. You can press the Backspace key to see the prompt. Release the key and enter the password for the encrypted file system, while ignoring the logging messages.

    The initramfs switch_root prompt appears.

  • The file system is mounted read-only on /sysroot/. You will not be allowed to change the password if the file system is not writable.

    Remount the file system as writable:

    switch_root:/# mount –o remount,rw /sysroot

  • The file system is remounted with write enabled. Change the file system's root as follows:

switch_root:/# chroot /sysroot

The prompt changes to sh-4.2#.

  • Enter the passwd command and follow the instructions displayed on the command line to change the root password.

    Note that if the system is not writable, the passwd tool fails with the following error:

    Authentication token manipulation error

  • Updating the password file results in a file with the incorrect SELinux security context. To relabel all files on next system boot, enter the following command:

    sh-4.2# touch /.autorelabel

    Alternatively, to save the time it takes to relabel a large disk, you can omit this step provided you included the enforcing=0 option in step 3.

  • Remount the file system as read only:

    sh-4.2# mount –o remount,ro /

  • Enter the exit command to exit the chroot environment
  • Enter the exit command again to resume the initialization and finish the system boot.s

    With an encrypted file system, a password or phrase is required at this point. However the password prompt might not appear as it is obscured by logging messages. You can press and hold the Backspace key to see the prompt. Release the key and enter the password for the encrypted file system, while ignoring the logging messages.

NOTE

Note that the SELinux relabeling process can take a long time. A system reboot will occur automatically when the process is complete.

  • If you added the enforcing=0 option in step 3 and omitted the touch /.autorelabel command in step 8, enter the following command to restore the /etc/shadow file's SELinux security context:

    # restorecon /etc/shadow

    Enter the following commands to turn SELinux policy enforcement back on and verify that it is on:

    # setenforce 1

    # getenforce

    Enforcing

Resetting the Root Password Using rd.break for RHEL7的更多相关文章

  1. mysql forget root password

    http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password MySQL - ...

  2. Linux - Reset a MySQL root password

    Use the following steps to reset a MySQL root password by using the command line interface. Stop the ...

  3. MYSQL更改root password时遇到Access Denied的解决办法

    今天在公司虚拟机上装MYSQL之后需要修改root password,然而遇到这样的错误: Access denied for user 'root'@'localhost' (using passw ...

  4. mysqladmin -u root password

    ERROR : Error appeared during Puppet run: 192.77.108.242_mysql.ppError: mysqladmin -u root  password ...

  5. MYSQL安装时解决要输入current root password的解决方法

    在装MYSQL的时候发现要输入current root password不记得以前在电脑里装过(你的系统曾经装过MYSQL在重装就会要求输入原来设定的密码,如果是第一次安装就不会出现),在网上苦苦搜寻 ...

  6. centos7开机出现try again to boot into default maintenance give root password for maintenance

    开启centos7出现下面两句话,然后直接输出root密码,就可以登录,但是登录后,发现一些文字显示出来的是乱码 try again to boot into default maintenanceg ...

  7. linux系统无法启动,提示give root password for maintenance错误

    电脑的虚拟机安装的是centos6.2操作系统,今天打开虚拟机时候,提示 give root password for maintenance (or type control-D to contin ...

  8. linux开机出现Give root password for maintenance (or type Control-D to continue):解决办法

    修改rc.local后导致 linux开机出现Give root password for maintenance,而且很多系统文件无法修改,之前的rc.local也不能修改了,单用户模式也无法进入 ...

  9. Give root password for maintenance

    linux开机出现"Give root password for maintenance (or type Control-D to continue):" 出现这种情况一般为两种 ...

随机推荐

  1. caffe 卷积层的运算

    贾清扬寻找快速算法之路:https://github.com/Yangqing/caffe/wiki/Convolution-in-Caffe:-a-memo 卷积运算图文并茂:http://www. ...

  2. linux中的网络基础

    ifconfig -a 查看所有网口ifconfig eth 查看具体网口 ifup ethoifdown etho 网卡配置文件/etc/sysconfig/networkk-scripts/ifc ...

  3. ios PageControl and UIScrollView

    // //  AlbumViewController.m //  HwangKop08.18 // //  Created by rimi on 15/8/20. //  Copyright (c) ...

  4. ubuntu安装依赖:0.8.1-1ubuntu4.4 正要被安装以及vm nested解决方法

    刚才在ubuntu10.04虚拟机上安装kvm,提示0.8.1-1ubuntu4.4 正要被安装,查了一下,有一种解决方法: 进入“系统->系统管理->更新管理器->设置”,在弹出的 ...

  5. 如何最快速地将旧的 NuGet 包 (2.x, packages.config) 升级成新的 NuGet 包 (4.x, PackageReference)

    最近我将项目格式进行了升级,从旧的 csproj 升级成了新的 csproj:NuGet 包管理的方式也从 packages.config 升级成了 PackageReference.然而迁移完才发现 ...

  6. callback回调函数-python

    链接:http://www.zhihu.com/question/19801131/answer/27459821来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 编程分 ...

  7. SQL 中nvarchar和varchar到底能存多少汉字和英文

    实践出真知,在SQL中,nvarchar(50)表示汉字和英文都是50,varchar(50)汉字25,英文50

  8. Linux之 xstart调用 x11vnc远程图形化桌面

    问题:用 xmanager 中的 xstart 启动界面,报x11无法打开 . 1. root调整x11参数,将其打开[root@localhost ~]# vi /etc/ssh/sshd_conf ...

  9. 相关TableLayoutPanel分页显示自定义控件

    public partial class AcrossGrid : UserControl { /// <summary> /// 一页数量 /// </summary> ; ...

  10. opencv读取中文路径报错的问题

    ) ## 经验证,不需要再转bgr,myImread的读图结果已经是和imread一样的 return img