linux系统中登录密码忘记了,在root中怎么修改登录密码

发布网友 发布时间:2022-03-20 11:27

我来回答

6个回答

热心网友 时间:2022-03-20 12:57

passwd 用户名然后输两遍密码

热心网友 时间:2022-03-20 14:15

进单用户 。 或者挂载救援盘 进去修改。 这个网上很多教程的,不在这里复制了

热心网友 时间:2022-03-20 15:49

linux root密码找回方法一
第1步:在系统进入单用户状态,直接用passwd root去更改。
第2步:用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法如下:
cd /mnt mkdir hd mount -t auto /dev/hdaX(原来/分区所在的分区号) hd cd hd chroot ./ passwd root
第3步:将本机的硬盘拿下来,挂到其他的linux系统上,采用的办法与第二种相同.
linux root密码找回方法二
第1步:用lilo引导系统时:在出现 lilo: 提示时键入 linux single
画面显示lilo: linux single
第2步:回车可直接进入linux命令行
第3步:使用以下命令“vi /etc/shadow”将第一行,即以root开头的一行中root:后和下一个:前的内容删除,第一行将类似于root::......保存
vi /etc/shadow
第4步:reboot重启,root密码为空。
linux root密码找回方法三
第1步:用grub引导系统时:在出现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=/ single
第4步:回车返回,然后按b键启动,即可直接进入linux命令行.
第5步:使用以下命令“vi /etc/shadow”将第一行,即以root开头的一行中root:后和下一个:前的内容删除,第一行将类似于root::......保存
vi /etc/shadow
第6步:reboot重启,root密码为空。

热心网友 时间:2022-03-20 17:41

单用户进入 #password 修改root密码 ;#password users 修改users 密码

REHL6/Centos 6
1. grub
进入启动画面之后,敲入“e”,把光标移动到kernel ...那一行,再敲入“e”,在kernel 一行的最后加上空格single,回车
敲入“b”,启动系统,即进入单用户模式,
这个时候就可以用passwd命令改密码了。
passwd root
改完以后reboot重启。
2. lilo
进入lilo命令行模式,敲入linux single,即进入单用户模式。

REHL7/Centos 7
If you have lost or forgot root password of RHEL7, you can follow this step to change to a new password, this is different with the RHEL6 single-usermode,
1, press e button in GRUB 2 boot screen.
2, at the end of Linux line add init=/bin/sh and remove 'rhgb' and 'quiet'
3, Ctrl+x to boot the system with the parameter
4, remount the file system as writable, run the mount -o remount, rw / command
5, passwd to change password.
6, make sure SELinux context of the files that were modified is restored, touch /.autorelabel
7, last step, resume the initialization and finish the system boot. exec /sbin/init

1. 添加init=/bin/sh 移除'rhgb' and 'quiet'
2. Ctrl+x
3. mount -o remount, rw /
4. passwd
5. touch /.autorelabel {selinux 开启时}
6. exec /sbin/init
7. 进入单用户显示乱码使用:LANG=zh-cn.utf8

热心网友 时间:2022-03-20 19:49

passwd 用户名貌似是

热心网友 时间:2022-03-20 22:13

passwd 用户名

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com