Linux操作系统下忘记登录密码这个棘手问题的解决方案------密码破译

本文介绍了在Linux系统中重置管理员密码的详细步骤。包括重启系统、中断引导加载器倒计时、编辑启动项、追加rd.break、重新挂载/sysroot为读写模式、切换到chroot环境、设置新密码等,最后退出编辑界面使系统重启。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Reboot the system.(重启当前Linux操作系统)
2.Interrupt the boot loader count down by pressing anykey.
3.Move the cursor to the entry that needs to be booted.
4.Press “e” to edit the select edentry.(在下列界面中,按e键进入编辑界面)
在这里插入图片描述
5.Move the cursor to the kernel command line(the line that start swith linux16.(寻找Linux16开头的内容所在行)
6.Append rd.break.(追加rd.break,如下图所示)
在这里插入图片描述
7.Press Ctrl+x to start.(ctrl+x开始执行操作)
8.Remount /sysroot as read-write.(取消/sysroot的只读挂载)

switch_root:/# mount -o remount,rw /sysroot(此命令是以读写的形式重新挂载/sysroot)

9.Switch into a chroot jail, where /sysroot is treated as the root of the filesystem tree

switch_root:/# chroot /sysroot(此程序标识更改程序执行时所参考的根目录)

10.Set a new root password:(对管理员用户设置新的密码,)

sh-4.2# passwd [root]	(change the root password)(对root用户设置新密码)
or或
sh-4.2# passwd -d root	(delete the root password)(直接删除root用户的密码,进行无密码登录,进入系统后可以再根据passwd命令完成对root用户的密码设置)

11.Make sure that all unlabeled files (including/etc/shadow at this point)get relabeled during boot.

sh-4.2# touch /.autorelabel(创建安全标签文件,这是对SELinux相应的设置,设置完成后,你将在安全的Linux环境下工作,如果这块未设置的话将重启失败)

12.sh-4.2# exit
13. switch_root:/# exit(通过exit命名退出编辑界面后,系统自动重新启动)
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值