build your new root passwd:
1.reboot, in grub, padd "single" to the end of kernel line to boot the system into single user mode
2. chmod 777 /etc/passwd
vi /etc/passwd
then you delete the x in root (delete root passwd)
passwd
set your new root passwd
OK,you have changed your root passwd
if you are not in sudoers, you can't use sudo...
then , in single user mode
whereis sudoers
find out your sudoers file path
chmod 777 /etc/sudoers
vi /etc/sudoers
under the line of "root ALL=(ALL) ALL
add : youname ALL=(ALL) ALL
save and exit
chmod 440 /etc/sudoers
ok, now you can use sudo ...
本文介绍如何在单用户模式下通过GRUB引导系统并修改root密码。此外还提供了将普通用户添加到sudoers文件的方法,以便使用sudo命令。
1519

被折叠的 条评论
为什么被折叠?



