• 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. [OpenCV笔记]0.OpenCV中显示多张图像

    摘要 本文主要介绍OpenCV中同时显示多张IplImage图像的方法(C++形式的多图显示需要修改,用vector<Mat>可能比较方便),有点类似MATLAB中的subplot,只是暂 ...

  2. 将HTML的页脚固定在屏幕下方

    /********************************************************************* * 将HTML的页脚固定在屏幕下方 * 说明: * 处理的 ...

  3. #Eclipse web工程 部署 三种方式 3

    Eclipse web工程 部署 三种方式 3.热部署 在Eclipse中,实现 修改一个.java文件或者.jsp文件甚至是配置文件,不需要重启WEB服务器的前提下让修改生效,实现tomcat自动加 ...

  4. PCA最小平方误差理论推导

    PCA最小平方误差理论推导 PCA求解其实是寻找最佳投影方向,即多个方向的标准正交基构成一个超平面. 理论思想:在高维空间中,我们实际上是要找到一个d维超平面,使得数据点到这个超平面的距离平方和最小 ...

  5. java大文件断点续传

    java两台服务器之间,大文件上传(续传),采用了Socket通信机制以及JavaIO流两个技术点,具体思路如下: 实现思路:1.服:利用ServerSocket搭建服务器,开启相应端口,进行长连接操 ...

  6. BZOJ3277 串 【广义后缀自动机】

    Description 字符串是oi界常考的问题.现在给定你n个字符串,询问每个字符串有多少子串(不包括空串)是所有n个字符串中 至少k个字符串的子串(注意包括本身). Input 第一行两个整数n, ...

  7. atom的设置

    1.隐藏Keybinding Resolver Packages->Keybinding Resolver->Toggle.

  8. Android.mk用法详解

    一.Android.mk介绍 Android.mk是Android提供的一种makefile文件,用来指定诸如编译生成so库名.引用的头文件目录.需要编译的.c/.cpp文件和.a静态库文件等.要掌握 ...

  9. 从wiresharp看tcp三次握手

    我们知道,传输层是OSI模型中用户进行数据传输的分层,目前仅有TCP和UDP两种协议可用.TCP为了进行传输控制,引入了三次握手机制,以确保通信连接的建立.道理很简单,我们跟别人打电话聊天时,对方拿起 ...

  10. phpstudy mysql无法启动

    在安装好phpstudy后,Apache可以启动,Mysql无法启动. 以管理员的身份运行cmd,然后输入sc delete mysql  即可