问题遇到的现象和发生背景
用代码块功能插入代码,请勿粘贴截图
我想要达到的结果
我的问题是这样的,四年前师兄给安装了一个LM操作系统,但是现在我把系统密码忘记了,我问师兄,师兄说找不回,只能重装系统了,想请问有没有代码可以找回LM系统的密码啊?
你说的是这个操作系统吗?多少版本的?
Reboot your computer / Turn your computer on.
Hold down the Shift key at the start of the boot process to enable the GNU GRUB boot menu (if it does not show)
Press ESC at the GNU GRUB prompt.
Press e for edit.
Use the Arrow keys to highlight the line that begins with kernel and press the e key.
Go to the very end of the line and add rw init=/bin/bash
Press Enter and then press b to boot your system.
Your system will boot up to a passwordless root shell.
Type in passwd yourusername
Set your new password.
Restart your system.
Because Linux Mint is based on Ubuntu, I would recommend the information on the official Wiki at
LostPassword - Community Help Wiki
instead.
进入救援模式,重新修改密码?
- At the GRUB prompt, press the letter,
e
, to edit. - Scroll to the kernel's boot line.
- Add to the end of the kernel boot parameters this value:
init=/bin/bash
- Press
[ENTER]
and then b
to boot. - Remount the root file system in read-write mode:
mount -o remount,rw /
- Change the password:
passwd
- Reboot:
reboot
https://blog.csdn.net/happy5856/article/details/1882109
一. lilo引导
- 在出现 lilo: 提示时键入 linux single
Boot: linux single - 回车可直接进入linux单用户模式
- vi /etc/passwd
一. lilo引导 - 在出现 lilo: 提示时键入 linux single
Boot: linux single - 回车可直接进入linux单用户模式
- vi /etc/passwd
删除root项中的密码
(这里也可以直接使用passwd命令重新设置root的密码) - reboot重启,root密码为空
二. grub引导 - 在出现grub画面时,选择linux引导项,然后按e键
- 选择以kernel开头的一行,再按e 键,在此行的末尾,按空格键后输入single,以回车键来退出编辑模式;
- 回车返回,然后按b键启动,即可直接进入linux单用户模式
- vi /etc/passwd
删除root项中的密码
(这里也可以直接使用passwd命令重新设置root的密码)
5、reboot重启,root密码为空
三、可以使用linux启动软盘引导
出现boot后,输入linux single
可进入单用户模式;
修改或删除root密码;
四、使用Linux 系统安装盘
如果你既没做系统启动软盘,同时多系统的引导LILO 和GRUB 又被删除,那么只能使用Linux 系统安装盘来恢复root的密码。
用第一张Linux 系统安装盘启动,出现boot 提示符后输入:
oot: linux rescue
此时系统进入救援模式,然后根据提示完成: - 选择语言和键盘格式;
- 选择是否配置网卡,一般系统因网络不需要,所以可以选择否跳过网卡配置;
- 选择是否让系统查找硬盘上的Redhat Linux 系统,选择继续;
- 系统显示硬盘上的系统已经被找到,并挂载在/mnt/sysimage 下;
- 进入拯救状态,可重新设置root 的密码:
chroot/mnt/sysimage (让系统成为根环境)
cd /mnt/sysimage
passwd root
五、卸下硬盘挂到别的机器上更改
如果不怕麻烦的话,还可以把安装linux的硬盘卸下后挂到其他系统环境下同样是去修改/etc/passwd文件,修改过后保存即可;
注:
1、在不同的linux系统下输入single的方式和方法可能有区别,希望能自己去尝试;
2、除了需要修改/etc/passwd文件外,可能也需要修改/etc/shadow文件,这是/etc/passwd密码文件的投影文件。