如何完全删除根密码

时间:2021-05-08 19:54:09

I am running slitaz distro, and would like to completely remove the root password. I have tried giving a blank password to the passwd command, however that did not seem to do the trick. It gave me an error password was too short, ans it still asked me for a password when I ssh-ed in. The password was just hiting the "Enter" key.

我正在运行slitaz发行版,希望完全删除根密码。我尝试过给passwd命令一个空白密码,但是这似乎并没有起到什么作用。它给了我一个错误密码太短,而且当我闪人的时候它还问我要密码。密码就是输入“Enter”键。

UPDATE:
Perhaps it has to do with the fact that slitaz uses dropbear for ssh? Because even with a blank password for root in /etc/shadow, it still prompts for a password.

更新:可能与slitaz使用dropbear作为ssh的事实有关吧?因为即使在/etc/shadow中为root设置了空白密码,它仍然会提示输入密码。

1 个解决方案

#1


62  

Did you try passwd -d root? Most likely, this will do what you want.

你试过wd -d根吗?很有可能,这将实现您想要的。


You can also manually edit /etc/shadow: (Create a backup copy. Be sure that you can log even if you mess up, for example from a rescue system.) Search for "root". Typically, the root entry looks similar to

您还可以手动编辑/etc/shadow:(创建备份副本。即使你搞砸了,也要确保你能记录下来,比如在救援系统中。搜索“根”。通常,根条目看起来类似于

root:$X$SK5xfLB1ZW:0:0...

There, delete the second field (everything between the first and second colon):

在那里,删除第二个字段(第一个和第二个冒号之间的所有内容):

root::0:0...

Save the file, and try logging in as root. It should skip the password prompt. (Like passwd -d, this is a "no password" solution. If you are really looking for a "blank password", that is "ask for a password, but accept if the user just presses Enter", look at the manpage of mkpasswd, and use mkpasswd to create the second field for the /etc/shadow.)

保存文件,并尝试以root用户身份登录。它应该跳过密码提示。(就像passwd -d一样,这是一个“无密码”解决方案。如果您正在寻找“空白密码”,即“询问密码,但如果用户只是按Enter,则接受”,请查看mkpasswd的manpage,并使用mkpasswd为/etc/shadow创建第二个字段。

#1


62  

Did you try passwd -d root? Most likely, this will do what you want.

你试过wd -d根吗?很有可能,这将实现您想要的。


You can also manually edit /etc/shadow: (Create a backup copy. Be sure that you can log even if you mess up, for example from a rescue system.) Search for "root". Typically, the root entry looks similar to

您还可以手动编辑/etc/shadow:(创建备份副本。即使你搞砸了,也要确保你能记录下来,比如在救援系统中。搜索“根”。通常,根条目看起来类似于

root:$X$SK5xfLB1ZW:0:0...

There, delete the second field (everything between the first and second colon):

在那里,删除第二个字段(第一个和第二个冒号之间的所有内容):

root::0:0...

Save the file, and try logging in as root. It should skip the password prompt. (Like passwd -d, this is a "no password" solution. If you are really looking for a "blank password", that is "ask for a password, but accept if the user just presses Enter", look at the manpage of mkpasswd, and use mkpasswd to create the second field for the /etc/shadow.)

保存文件,并尝试以root用户身份登录。它应该跳过密码提示。(就像passwd -d一样,这是一个“无密码”解决方案。如果您正在寻找“空白密码”,即“询问密码,但如果用户只是按Enter,则接受”,请查看mkpasswd的manpage,并使用mkpasswd为/etc/shadow创建第二个字段。