我使用puttyloginLinux服务器后,如何将私钥修改为用户自定义密码?

使用puttylogin我的Linux服务器后,如何将我的login密码从私钥更改为用户自定义密码,以便我loginLinux服务器时可以使用用户自定义密码?

假设SSH服务器允许你用密码login,这应该工作,否则你需要configuration守护进程来允许密码login。

如果您需要为您的帐户设置密码

login后inputpasswd

用户@主机:〜$ passwd
更改用户的密码。
 (当前)UNIX密码: 
input新的UNIX密码: 
重新键入新的UNIX密码: 
 passwd:密码更新成功

然后在主机configuration/configuration文件中禁用Putty中的密钥authentication

http://subatomicsolutions.org/images/putty.jpg

您可以稍后恢复使用SSH密钥在Putty中进行configuration。

如果您想阻止服务器允许使用您的SSH密钥login

编辑文件~/.ssh/authorized_keys并从列表中删除您的密钥。 或者删除~/.ssh/authorized_keys来完全禁用您的账户的密钥authentication(例如,如果有其他密钥)。 确保你可以先login另一种方式!

如果sshd守护程序被configuration为拒绝密码login或rootlogin

你将不得不修改它的configuration文件/etc/ssh/sshd_config 。 阅读man sshd_config并阅读configuration文件中的注释。 如果您尝试以root身份使用密码login,则可能会被禁用,并且必须启用。

总的想法

 #允许用密码login(默认是在openssh是我相信)
 PasswordAuthentication yes

 #允许root用一个密码login(小心!可能是个坏主意)
 PermitRootLogin是

然后重新启动SSH守护进程。

 /etc/init.d/ssh restart 

所有的例子都适用于基于Debian / Ubuntu的发行版

对于Ubuntu(应该与其他发行版类似,以root身份运行命令):

/etc/ssh/sshd_config ,将PasswordAuthentication no行更改为PasswordAuthentication yes ,然后运行/etc/unit.d/sshd restart

然后打开另一个腻子窗口并进行testing(以便在出现问题时可以更改configuration)。

它应该在下次login时要求您input密码。