ssh: unable to authenticate, attempted methods [none publickey], no supporte

关于SSH登录不了的问题,总是 ssh: unable to authenticate, attempted methods [none publickey], no supporte 错误。

折腾了一下午不知道怎么回事,虽然提示很明显是公钥出问题了,我对比了很多遍都没有错误,郁闷了~

经过一番探索,发现是目录权限的问题!!!

起因是.ssh 是我手动创建的,authorized_keys也是我手动vim的,所以存在了权限问题。

划重点!划重点!划重点!

SSH目录和文件的权限不能多也不能少!!!

.ssh 目录必须是 744,authorized_keys 文件必须是 600

 解决方案:

如果是手动创建的目录和文件,进行权限修改。

chmod 744 .ssh

cd .ssh

chmod 600 authorized_keys

最好的方案是不要手动创建权限,通过命令 ssh_****** 系统会自动生成目录和文件,然后替换为需要的公钥即可。

ssh: unable to authenticate, attempted methods [none publickey], no supporte