goback add

linux单用户密码破解

9937 点击·0 回帖
灯火互联
楼主
来源:Linux系统中文网  
ubunt
 1,开机到grub时,用上下键移到第二行的恢复模式,按e(注意不是回车)
 即Ubutn,kernel 2.6.12-9-386(recovery mode)
 2,把ro single 改成rw single init=/bin/bash      然后按ctrl+x
 
RHEL 6/centos 6
 1. grub
 进入启动画面之后,敲入“e”,把光标移动到kernel ...那一行,再敲入“e”,在kernel 一行的最后加上空格single,回车
 敲入“b”,启动系统,即进入单用户模式,
 这个时候就可以用passwd命令改密码了。
 passwd root
 改完以后reboot重启。
 2. lilo
 进入lilo命令行模式,敲入linux single,即进入单用户模式。
 

REHL7/Centos 7 (grub2)
 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

喜欢0 评分0