权限被拒绝(公钥)?

权限被拒绝(公钥)?

当我尝试连接服务器时出现此错误

你能帮助我吗?

谢谢!

远程控制[电子邮件保护]-vvv

OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /home/njfamirm/.ssh/config
debug1: /home/njfamirm/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/njfamirm/.ssh/known_hosts'
debug2: resolving "srv.alimd.ir" port 22
debug3: resolve_host: lookup srv.alimd.ir:22
debug3: ssh_connect_direct: entering
debug1: Connecting to srv.alimd.ir [94.237.24.136] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: Connection established.
..
.
.
.
.
.
.
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/njfamirm/.ssh/id_rsa RSA SHA256:nG0n/dYkV6P2wHzjnOXEKe2LjIFWYe9CnZvb7zHljxk
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/njfamirm/.ssh/id_dsa
debug3: no such identity: /home/njfamirm/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/njfamirm/.ssh/id_ecdsa
debug3: no such identity: /home/njfamirm/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/njfamirm/.ssh/id_ecdsa_sk
debug3: no such identity: /home/njfamirm/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/njfamirm/.ssh/id_ed25519
debug3: no such identity: /home/njfamirm/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/njfamirm/.ssh/id_ed25519_sk
debug3: no such identity: /home/njfamirm/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/njfamirm/.ssh/id_xmss
debug3: no such identity: /home/njfamirm/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).

〜/.ssh /配置

Host *
    StrictHostKeyChecking ask
    UserKnownHostsFile ~/.ssh/known_hosts
    LogLevel INFO
    ServerAliveInterval 120

答案1

看来您的服务器只需要使用 ssh 密钥进行连接。您的计算机上似乎缺少此文件:

/home/njfamirm/.ssh/id_dsa

您可以使用 ssh-keygen 创建一个新的密钥,但这对现有服务器来说可能会出现问题,因为另一个密钥可能已经部署。

也许你换了电脑?

相关内容