网上找了一天!!! 我遇见的中文的修复密码教程全部不能用(什么修改Grup内核啦, 删除Root密码啦, 复制其他用户密码到Root密码啦, 或者什么获取root权限之后使用passwd来修改啦, 全是不能使用在以下的环境中:
① Ubuntu9.04 amd64 desktop
② 启用了Root, 并设置了Root密码
③ 把目录 /, /home, /etc 等关键目录挂载在不同的分区上
所以就求助于英文了.
结果真找到了: (懒得翻译了, 因为这篇文章估计没几个会看到. 如果你要我翻译, 就发邮件给我吧: lanshunfang#gmail.com -- 把#替换成@)
URL: http://ubuntuforums.org/archive/index.php/t-1177638.html
方法:
I was looking for something like this but when I follow these steps, I got the root prompt but when I enter passwd <username> command, it says me bash passwd: command not found. It's weird ....:(
hmmmm
maybe the PATH variable is not set
try:
/usr/bin/passwd <uname>
and of course if you have a different /usr partition, then you have to mount it:
mount /dev/sd<XY> /usr
If you set a root password, though, you cannot boot into recovery mode, so, yes, you would use a live CD to reset the password. Probably the easiest thing would be to edit the /etc/shadow file and confirm the admin user is in the admin group and that sudo is working properly
Excellent idea.
OP: boot the LiveCD, mount the root partition and lock the root password by editing the /etc/shadow file.
from something like this
root:$1$xT12LOOLWUT$L<thisisthepassword>qs2/wM4nNIWjNPidn1R/:14396::::::
bin:x:0::::::
daemon:x:0::::::
to
root:!:14396::::::
bin:x:0::::::
daemon:x:0::::::
$1$xT12LOOLWUT$L<thisisthepassword>qs2/w....1R/ is the encrypted password, you have to replace it with "!" to lock the root account.
then you can reboot in recovery mode.
大意就是说将/etc/shadow里面的第一行的Root密码修改成"!"来首先禁用Root, 然后用Grup的还原模式启用Root Shell来修改Root密码 (使用passwd)