forgot root passwd or not in the sudoers???

来源:互联网 发布:网站流量分析哪些数据 编辑:程序博客网 时间:2024/05/08 11:46

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 ...

原创粉丝点击