重启后的Ubuntu服务器ssh:权限被拒绝(publickey)
我有一个服务器设置,我可以从我的mac ssh到。 使用可信密钥进行设置,它完美无缺。 但每当我重新启动服务器而我尝试使用ssh my_user@ip
登录时,它会说: Permission denied (publickey).
但是,如果我实际上去了服务器并以my_user身份登录,那么突然我也可以通过ssh从我的mac进行远程访问。 我的设置需要更改什么?
好吧,问题是密钥存储在〜/ .ssh / authorized_keys中
使用加密的主页,您无法使用密钥登录,因为您的主目录已加密。
将授权密钥移动到其他地方,我个人使用/etc/ssh/.authorized_keys
然后编辑/etc/ssh/sshd_config
,添加/编辑该行
AuthorizedKeysFile /etc/ssh/.authorized_keys
重启ssh服务器。
也可以看看:
http://manpages.ubuntu.com/manpages/precise/en/man5/sshd_config.5.html