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):" 出现这种情况一般为两种 ...
随机推荐
- GitHub https链接中输入账户和密码
/********************************************************************** * GitHub https链接中输入账户和密码 * 说 ...
- 学校项目过程中知识点 Java 2015/9/15 晚
##命令行运行Java程序1.文件Java的源代码存放在扩展名为“.java”的文件中:Java源文件编译后,得到“.class”的文件2.方法命令行下编译java源代码的方法:javac 文件名. ...
- 写一个Python的windows服务
1. 安装pywin32和pyinstaller pip install pywin32 pip install pyinstaller 2.写一个服务Demo # -*- coding: utf-8 ...
- XMLHttpRequest cannot load file浏览器无法异步加载本地file文件
原因:Chrome不支持本地Ajax请求,在.html文件中访问.json文件时就会出现这个问题,就是说这个时候不能加载这个.html文件. 解决方式 打开Chrome快捷方式的属性中设置: 右击Ch ...
- Java并发--同步容器
为了方便编写出线程安全的程序,Java里面提供了一些线程安全类和并发工具,比如:同步容器.并发容器.阻塞队列.Synchronizer(比如CountDownLatch).今天我们就来讨论下同步容器. ...
- getServletContext()方法详解
javax.servlet.ServletContext接口 一个servlet上下文是servlet引擎提供用来服务于Web应用的接口.Servlet上下文具有名字(它属于Web应用的名字)唯一映射 ...
- Loj 538 递推数列
Loj 538 递推数列 出题人:这题提高难度吧.于是放在了%你赛的 \(D1T2\) . 递推式为 \(a_i=k*a_{i-1}+a_{i-2}\) , 注意到 \(k\in \mathbb{N_ ...
- 【最全 干货 实例】 缓存手册(Memcached、redis、RabbitMQ)
http://www.cnblogs.com/suoning/p/5807247.html 本章内容: Memcached 简介.安装.使用 Python 操作 Memcached 天生支持集群 re ...
- CF 1093E Intersection of Permutations——CDQ分治
题目:http://codeforces.com/contest/1093/problem/E 只能想到转化成查询一个区间里值在一个范围里的数的个数…… 没有想到这样适合用主席树套树状数组维护.不过据 ...
- spring整合xfire出现Document root element "beans", must match DOCTYPE root "null"错误解决方案
fire自带的包下有个spring1.2.6的jar包,而工程的jar包是2.0的. 解决方案: 1.将原配置文件的头schema方式换为DOCTYPE方式,原配置文件如下(非maven) <? ...