当前位置: 技术问答>linux和unix
请教各位我的linux登陆密码丢了 还有其他办法进去吗?
来源: 互联网 发布时间:2015-04-07
本文导语: 同题 | linux的手册上的,自己看看: 9.3. Booting into Single-User Mode One of the advantages of single-user mode is that you do not need a boot diskette or CD-ROM; however, it does not give you the option to ...
同题
|
linux的手册上的,自己看看:
9.3. Booting into Single-User Mode
One of the advantages of single-user mode is that you do not need a boot diskette or CD-ROM; however, it does not give you the option to mount the file systems as read-only or not mount them at all.
In single-user mode, your computer boots to runlevel 1. Your local file systems are mounted, but your network is not activated. You have a usable system maintenance shell. Unlike rescue mode, single-user mode automatically tries to mount your file system; do not use single-user mode if your file system can not be mounted successfully. You can not use single-user mode if the runlevel 1 configuration on your system is corrupted.
If your system boots, but does not allow you to log in when it has completed booting, try single-user mode.
If you are using GRUB, use the following steps to boot into single-user mode:
1. If you have a GRUB password configured, type p and enter the password.
2. Select Red Hat Linux with the version of the kernel that you wish to boot and type e for edit. You will be presented with a list of items in the configuration file for the title you have selected.
3. Select the line that starts with kernel and type e to edit the line.
4. Go to the end of the line and type single as a separate word (press the [Spacebar] and then type single). Press [Enter] to exit edit mode.
5. Back at the GRUB screen, type b to boot into single-user mode.
If you are using LILO, at the LILO boot prompt (if you are using the graphical LILO, you must press [Ctrl]-[x] to exit the graphical screen and go to the boot: prompt) type:
linux single
9.3. Booting into Single-User Mode
One of the advantages of single-user mode is that you do not need a boot diskette or CD-ROM; however, it does not give you the option to mount the file systems as read-only or not mount them at all.
In single-user mode, your computer boots to runlevel 1. Your local file systems are mounted, but your network is not activated. You have a usable system maintenance shell. Unlike rescue mode, single-user mode automatically tries to mount your file system; do not use single-user mode if your file system can not be mounted successfully. You can not use single-user mode if the runlevel 1 configuration on your system is corrupted.
If your system boots, but does not allow you to log in when it has completed booting, try single-user mode.
If you are using GRUB, use the following steps to boot into single-user mode:
1. If you have a GRUB password configured, type p and enter the password.
2. Select Red Hat Linux with the version of the kernel that you wish to boot and type e for edit. You will be presented with a list of items in the configuration file for the title you have selected.
3. Select the line that starts with kernel and type e to edit the line.
4. Go to the end of the line and type single as a separate word (press the [Spacebar] and then type single). Press [Enter] to exit edit mode.
5. Back at the GRUB screen, type b to boot into single-user mode.
If you are using LILO, at the LILO boot prompt (if you are using the graphical LILO, you must press [Ctrl]-[x] to exit the graphical screen and go to the boot: prompt) type:
linux single
|
假如你的linux是用grub引导的:
使用安装盘重启,见到“boot:”后输入vmlinuz root=/dev/hdaX initerd;linux single
( hdaX是你linux安装的分区,X是数字 例hda4),这样就可以以单用户方式进到系统中去了,然后再运行命令“passwd”就可将root的密码给修改过来了。
假如你的linux是用lilo引导的:
就按ctrl+x(redhat)或esc(mandrake),“见到boot:”输入linux single 就可进到系统中了,随后passwd。
使用安装盘重启,见到“boot:”后输入vmlinuz root=/dev/hdaX initerd;linux single
( hdaX是你linux安装的分区,X是数字 例hda4),这样就可以以单用户方式进到系统中去了,然后再运行命令“passwd”就可将root的密码给修改过来了。
假如你的linux是用lilo引导的:
就按ctrl+x(redhat)或esc(mandrake),“见到boot:”输入linux single 就可进到系统中了,随后passwd。
|
找回忘记了的root口令(lilo/grub)
三种办法:
1.在系统进入单用户状态,直接用passwd root去更改
2.用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法如下:
cd /mnt
mkdir hd
mount -t auto /dev/hdaX(原来/分区所在的分区号) hd
cd hd
chroot ./
passwd root
这样可以搞定
3.将本机的硬盘拿下来,挂到其他的linux系统上,采用的办法与第二种相同
rh8中
一. lilo
1. 在出现 lilo: 提示时键入 linux single
画面显示 lilo: linux single
2. 回车可直接进入linux命令行
3. #vi /etc/shadow
将第一行,即以root开头的一行中root:后和下一个:前的内容删除,
第一行将类似于
root::......
保存
4. #reboot重启,root密码为空
二. grub
1. 在出现grub画面时,用上下键选中你平时启动linux的那一项(别选dos哟),然后按e键
2. 再次用上下键选中你平时启动linux的那一项(类似于kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/),然后按e键
3. 修改你现在见到的命令行,加入single,结果如下:
kernel /boot/vmlinuz-2.4.18-14 single ro root=LABEL=/
4. 回车返回,然后按b键启动,即可直接进入linux命令行
5. #vi /etc/shadow
将第一行,即以root开头的一行中root:后和下一个:前的内容删除,
第一行将类似于
root::......
保存
6. #reboot重启,root密码为空
三种办法:
1.在系统进入单用户状态,直接用passwd root去更改
2.用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法如下:
cd /mnt
mkdir hd
mount -t auto /dev/hdaX(原来/分区所在的分区号) hd
cd hd
chroot ./
passwd root
这样可以搞定
3.将本机的硬盘拿下来,挂到其他的linux系统上,采用的办法与第二种相同
rh8中
一. lilo
1. 在出现 lilo: 提示时键入 linux single
画面显示 lilo: linux single
2. 回车可直接进入linux命令行
3. #vi /etc/shadow
将第一行,即以root开头的一行中root:后和下一个:前的内容删除,
第一行将类似于
root::......
保存
4. #reboot重启,root密码为空
二. grub
1. 在出现grub画面时,用上下键选中你平时启动linux的那一项(别选dos哟),然后按e键
2. 再次用上下键选中你平时启动linux的那一项(类似于kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/),然后按e键
3. 修改你现在见到的命令行,加入single,结果如下:
kernel /boot/vmlinuz-2.4.18-14 single ro root=LABEL=/
4. 回车返回,然后按b键启动,即可直接进入linux命令行
5. #vi /etc/shadow
将第一行,即以root开头的一行中root:后和下一个:前的内容删除,
第一行将类似于
root::......
保存
6. #reboot重启,root密码为空
|
用启动光盘(安装盘第一张)
进入急救模式:linux rescue
chroot /mnt/sysimage
passwd
直接修改密码。
进入急救模式:linux rescue
chroot /mnt/sysimage
passwd
直接修改密码。
|
那么怎样才是单用户模式呢?
难道启动到Linux下,会有选项么?
我好像没有看到过呀,呵呵……我是新手,见者莫怪。^-^
难道启动到Linux下,会有选项么?
我好像没有看到过呀,呵呵……我是新手,见者莫怪。^-^