【翻译自mos文章】重置Oracle Linux 7中root的口令

本文介绍如何在Oracle Linux 7中重置root密码。步骤包括:启动时编辑GRUB菜单选项附加参数,使用rd.break挂载系统根文件系统为读写模式并进入chroot环境,使用passwd命令重置root密码,确保所有未标记文件重新标记,并重启系统。

来源于:Reset Root Password in Oracle Linux 7 (文档 ID 1954652.1)

注意:本文章也适用于RHEL7.x


APPLIES TO:

Linux OS - Version Oracle Linux 7.0 and later
Linux x86
Linux x86-64

GOAL

How to reset root password in Oracle linux 7

SOLUTION

1. While booting GRUB 2 Edit Menu Option (by pressing E)
2. Select the line starts with linux16******* (append "rd.break" at the end of the line), e.g.:

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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值