运维联盟俱乐部

 找回密码
 立即注册
查看: 2026|回复: 0

How to Reset Root Password in Oracle Linux 7

[复制链接]

该用户从未签到

发表于 2022-3-4 19:45:39 | 显示全部楼层 |阅读模式
1. While booting GRUB 2 Edit Menu Option (by pressing E)

2. Select the line starts with linux16**** (or linuxefi**** for UEFI bios)  and append "rd.break" at the end of the line.
Example:
linux16 **** rd.break

3. Press ctrl+x to boot or start.

4. First we will remount the sysroot file system in read and write mode and then use chroot to got into a chroot jail:
# mount -o remount,rw /sysroot
# chroot /sysroot


5. Type passwd command in the command line and press same password twice for reset root password:
# passwd

6. Make sure that all unlabel files ( including shadow ) get relabeled during booting:
# touch /.autorelabel

7. Type the command to sync:
# sync

8. Type twice exit command to leave & logout.

9. The system will apply some SELinux contexts and reboot.

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

运维联盟俱乐部 ( 冀ICP备19036648号 )

GMT+8, 2024-5-14 07:00 , Processed in 0.045460 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表