Resetting the Root Password Using rd.break for RHEL7
- 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的更多相关文章
- mysql forget root password
http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password MySQL - ...
- Linux - Reset a MySQL root password
Use the following steps to reset a MySQL root password by using the command line interface. Stop the ...
- MYSQL更改root password时遇到Access Denied的解决办法
今天在公司虚拟机上装MYSQL之后需要修改root password,然而遇到这样的错误: Access denied for user 'root'@'localhost' (using passw ...
- mysqladmin -u root password
ERROR : Error appeared during Puppet run: 192.77.108.242_mysql.ppError: mysqladmin -u root password ...
- MYSQL安装时解决要输入current root password的解决方法
在装MYSQL的时候发现要输入current root password不记得以前在电脑里装过(你的系统曾经装过MYSQL在重装就会要求输入原来设定的密码,如果是第一次安装就不会出现),在网上苦苦搜寻 ...
- centos7开机出现try again to boot into default maintenance give root password for maintenance
开启centos7出现下面两句话,然后直接输出root密码,就可以登录,但是登录后,发现一些文字显示出来的是乱码 try again to boot into default maintenanceg ...
- linux系统无法启动,提示give root password for maintenance错误
电脑的虚拟机安装的是centos6.2操作系统,今天打开虚拟机时候,提示 give root password for maintenance (or type control-D to contin ...
- linux开机出现Give root password for maintenance (or type Control-D to continue):解决办法
修改rc.local后导致 linux开机出现Give root password for maintenance,而且很多系统文件无法修改,之前的rc.local也不能修改了,单用户模式也无法进入 ...
- Give root password for maintenance
linux开机出现"Give root password for maintenance (or type Control-D to continue):" 出现这种情况一般为两种 ...
随机推荐
- 关于Objective-C 2.0 的垃圾收集
Objective-C 2.0最大的增强可能就是垃圾收集了(Garbage Collection).与“垃圾收集”对应的是传统的引用计数(Reference Count)内存管理形式. 使用了垃圾 ...
- matlab下利用K-Means进行图像分类
FIRST & BEST SOLUTION clear all; clc; I_rgb=imread('dog.jpg'); figure();imshow(I_rgb);title('原始图 ...
- Hadoop2.x下安装HBase
1.安装好 hadoop 集群,并启动 [grid@hadoop4 ~]$ /sbin/start-dfs.sh [grid@hadoop4 ~]$ /sbin/start-yarn.sh 查看 ha ...
- 使用PE工具箱 ughost 恢复系统导致被捆绑一堆软件的问题
很多的pe系统,都有这么一个东西, 没啥技术含量,就是给ghost 加一个UI 而已 , 但是使用这玩意恢复系统,会被感染一些捆绑软件 ,开机之后就会卡顿, 并下载一堆软件 包括 爱奇艺 , 百度搜 ...
- .net collection tips
1.数组对象都是Array的子类,Array是一个抽象类,不能显示实例化,Array提供了大量操作数组的静态方法 2.ArrayList其实是内部封装了一个array,实现了IList的接口.add ...
- ssm+PageHelper实现分页查询
通过搭建ssm框架,然后通过mybatis的分页插件pagehelp进行分页查询.源码:https://gitee.com/smfx1314/pagehelper 看一下项目结构: 首先创建一个mav ...
- 使用poi进行excel导入并解析插入数据库
前言 最近还得写excel的导入导出,结果还是得百度,虽然都能看懂,但是还是想记录下来这些东西 正文 1. 导入jar包 <dependency> <groupId>org.a ...
- Git 更安全的强制推送,--force-with-lease
由于 git rebase 命令的存在,强制将提交推送到远端仓库似乎也有些必要.不过都知道 git push --force 是不安全的,这让 git rebase 命令显得有些鸡肋. 本文将推荐 - ...
- 利用 TypeConverter,转换字符串和各种类型只需写一个函数
本文代码基于 .NET Framework 实现. 本来只想进行简单的配置存储的,不料发现 .NET 的基本类型多达十多种.于是,如果写成下面这样,那代码可就太多了哦: // 注:`Configura ...
- Python学习-类
类是对象的模板或蓝图,类是对象的抽象化,对象是类的实例化 在python中,一个对象的特征也称为属性(attribute),它所具有的的行为也称为方法(method) 对象 = 属性(特征)+方法(行 ...