如何从机器获得无密码 ssh 到自身?

如何从机器获得无密码 ssh 到自身?

经过多次尝试和重置后,从 ubuntu 20.04 机器到自身的无密码 ssh 现在失败。

我已经设置了很多次,但现在它似乎因公钥被拒绝错误而失败,我不明白。

我之前不得不搞乱设置密码。但不要认为就是这样。

密钥是通过ssh-keygent -t rsa和生成的ssh-add <keyfile>

cat /etc/ssh/sshd_config | grep -v '#'  | grep -v '^$'

输出

PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem   sftp    /usr/lib/openssh/sftp-server
cat /etc/ssh/ssh_config | grep -v '#'  | grep -v '^$'

输出

Include /etc/ssh/ssh_config.d/*.conf
Host *
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
cd ~/.ssh
ssh-add -D
ssh-add id_rsa
ssh localhost
we sent a publickey packet, wait for reply
Authentications that can continue: publickey
we did not send a packet, disable method
No more authentication methods to try.
Permission denied (publickey).

相关内容