• 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. U盘传送容量与格式问题

    问题 今天想将7.6G的文件拷到U盘里,提示u盘内存不足,其实内存为14+G. 解答 U盘格式对于U盘的传送大小有限制 下面为U盘三种不同格式的应用及优缺点 FAT32格式:为系统默认格式,具有极佳的 ...

  2. android 获取 图片或视频略缩图

    /** * 根据指定的图像路径和大小来获取缩略图 此方法有两点好处: 1. * 使用较小的内存空间,第一次获取的bitmap实际上为null,只是为了读取宽度和高度, * 第二次读取的bitmap是根 ...

  3. MySQL中的锁理解

    1.目的:解决客户端并发访问的冲突问题 2.锁的分类 1.锁类型 1.读锁(共享锁) 查询(select):加读锁之后,别人不能更改表记录,但是可以进行查询. 2.写锁(互斥锁,排他锁) 更新(upd ...

  4. C# Post发送数据返回页面结果

    public string GetPage(string posturl, string postData) { Stream outstream = null; Stream instream = ...

  5. Git-Svn 建立工作目录

    使用Git-SVN 建立工作目录 GIT-SVN可以以SVN的版本为基础, 实现”私有”的版本管理功能. 这样一些不成熟但又需要记录的版本就不必提交到SVN上, 而只在自己本地私有的版本里出现. 下面 ...

  6. Objective-C的属性和成员变量用法及关系浅析

    在使用Objective-C语言进行了一段时间的iOS开发之后,发现自己的语言基础相对薄弱,于是开始弥补自己的短处.我发现在用过一种语言之后,再回过头来看它的很多原理会发现有更加深刻的理解.下面就对一 ...

  7. 《DSP using MATLAB》示例Example 8.23

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  8. HTML5的28个常用特性

    1. 新的Doctype 尽管使用<!DOCTYPE html>,即使浏览器不懂这句话也会按照标准模式去渲染 2. Figure元素 用<figure>和<figcapt ...

  9. lua中的数学库

    Lua5.1中数学库的所有函数如下表: 使用数学库,不需要require,直接math.function就可以math.pi 为圆周率常量 = 3.14159265358979323846 abs 取 ...

  10. springboot各种集成

    fastjson 两个方法 @Configuration public class WebMvcConfigurer extends WebMvcConfigurerAdapter { @Overri ...