• 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. Android学习笔记之Activity详解

    1 理解Activity Activity就是一个包含应用程序界面的窗口,是Android四大组件之一.一个应用程序可以包含零个或多个Activity.一个Activity的生命周期是指从屏幕上显示那 ...

  2. 用两个stack实现一个队列

    class Queue { stack<int> input, output; public: void push(int x) { input.push(x); } void pop(v ...

  3. Srping框架中使用@query注解实现复杂查询

    [自己项目代码] @Query("select bean from User bean where bean.org.id=?1 and bean.group.id=?2") pu ...

  4. 剑指offer第五章

    剑指offer第五章 1.数组中出现次数超过一半的数 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字. 例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组 ...

  5. pat乙级 1091 N-自守数 (15 分)

    如果某个数 K 的平方乘以 N 以后,结果的末尾几位数等于 K,那么就称这个数为“N-自守数”.例如 3×92​2​​=25392,而 25392 的末尾两位正好是 92,所以 92 是一个 3-自守 ...

  6. 《DSP using MATLAB》示例Example 8.1

    终于看到第8章了,加油,继续努力! N为奇数,有极点位于实数轴上.事实上,所有极点位于Ωc=0.5为半径的圆上,而不是单位圆.

  7. ubuntu qq安装

    安装最新版qq2016 qq2012下载链接: https://pan.baidu.com/s/1miFVc04 密码: 3g9w 先解压到自己所在的目录,解压命令自己百度在这个目录下,有三个解压包, ...

  8. win7下VS2010编译python3

    转自:http://www.cnblogs.com/fortwo/archive/2013/04/16/3023871.html 1.首先从python.org上:http://www.python. ...

  9. 网站使用QQ登录问题小结

    关于网站如何使用QQ登陆这个问题就不多说了,很简单,登陆connect.qq.com找到相应的SDK,下载下来,里面会有demo,将相应的appid,appkey和回调地址callback改成自己的就 ...

  10. vs2013 + python3.52 + boost1.61, 编译C++库失败

    使用vs2013  + python3.52 + boost1.61,  编译C++库,  失败!  提示如下": boost::python::detail::init_module(st ...