Linux I';我无法ssh到DigitalOcean Ubuntu(20.04)服务器?我的sshd_配置和授权_密钥文件似乎还可以。详情如下 OpenSSH_8.6p1,OpenSSL 1.1.1k 2021年3月25日 debug1:读取配置数据/etc/ssh/ssh\u config debug1:连接到134.209.151.146[134.209.151.146]端口22。 debug1:已建立连接。 debug1:identity file/home/clive/.ssh/id\u rsa type-1 debug1:identity file/home/clive/.ssh/id\u rsa-cert类型-1 debug1:identity file/home/clive/.ssh/id_dsa type-1 debug1:identity file/home/clive/.ssh/id_dsa-cert type-1 debug1:identity file/home/clive/.ssh/id_ecdsa type-1 debug1:identity file/home/clive/.ssh/id_ecdsa-cert type-1 debug1:identity file/home/clive/.ssh/id\u ecdsa\u sk type-1 debug1:identity file/home/clive/.ssh/id\u ecdsa\u sk-cert type-1 debug1:identity file/home/clive/.ssh/id_ed25519类型3 debug1:identity file/home/clive/.ssh/id_ed25519-cert type-1 debug1:identity file/home/clive/.ssh/id_ed25519_sk type-1 debug1:identity file/home/clive/.ssh/id_ed25519_sk-cert type-1 debug1:identity file/home/clive/.ssh/id\u xmss type-1 debug1:identity file/home/clive/.ssh/id\u xmss-cert type-1 debug1:本地版本字符串SSH-2.0-OpenSSH_8.6 debug1:远程协议版本2.0,远程软件版本OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 debug1:compat_横幅:匹配:OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH*compat 0x04000000 debug1:将134.209.151.146:22验证为“clive” debug1:load_hostkeys:fopen/home/clive/.ssh/known_hosts2:没有这样的文件或目录 debug1:加载\u主机密钥:fopen/etc/ssh/ssh\u已知\u主机:没有这样的文件或目录 debug1:load_hostkey:fopen/etc/ssh/ssh_known_hosts2:没有这样的文件或目录 debug1:SSH2\u MSG\u KEXINIT已发送 debug1:SSH2\u MSG\u KEXINIT已收到 debug1:kex:算法:curve25519-sha256 debug1:kex:主机密钥算法:ssh-ed25519 debug1:kex:server->client cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:kex:client->server cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:需要SSH2\u MSG\u KEX\u ECDH\u回复 调试1:收到SSH2\u消息\u KEX\u ECDH\u回复 debug1:服务器主机密钥:ssh-ed25519 SHA256:X9T8dMRejOJgTDfHZo5kRvoVTD1moCRzX0F2jJmgGRk debug1:load_hostkeys:fopen/home/clive/.ssh/known_hosts2:没有这样的文件或目录 debug1:加载\u主机密钥:fopen/etc/ssh/ssh\u已知\u主机:没有这样的文件或目录 debug1:load_hostkey:fopen/etc/ssh/ssh_known_hosts2:没有这样的文件或目录 debug1:主机“134.209.151.146”已知,并且与ED25519主机密钥匹配。 debug1:在/home/clive/.ssh/known_hosts中找到密钥:2 debug1:在134217728块之后重新键入 debug1:SSH2\u MSG\u已发送新密钥 debug1:应为SSH2\u MSG\u NEWKEYS debug1:SSH2\u MSG\u接收到新密钥 debug1:在134217728块之后重新输入 debug1:将尝试密钥:/home/clive/.ssh/id\u rsa debug1:将尝试密钥:/home/clive/.ssh/id\u debug1:将尝试密钥:/home/clive/.ssh/id\u ecdsa debug1:将尝试密钥:/home/clive/.ssh/id\u ecdsa\u sk debug1:将尝试键:/home/clive/.ssh/id_ed25519 ed25519 SHA256:808r4drp8tnwnxsqln1rv0/fglyq3ef2so2kw debug1:将尝试密钥:/home/clive/.ssh/id\u ed25519\u sk debug1:将尝试键:/home/clive/.ssh/id\u xmss debug1:SSH2\u MSG\u EXT\u接收到信息 debug1:kex_输入_外部_信息:服务器信号algs= debug1:SSH2\u消息\u服务\u接收 debug1:可以继续的身份验证:公钥 debug1:下一个身份验证方法:公钥 debug1:正在尝试私钥:/home/clive/.ssh/id\u rsa debug1:正在尝试私钥:/home/clive/.ssh/id\u dsa debug1:正在尝试私钥:/home/clive/.ssh/id\u ecdsa debug1:正在尝试私钥:/home/clive/.ssh/id\u ecdsa\u sk debug1:提供公钥:/home/clive/.ssh/id_ed25519 ed25519 SHA256:808r4drp8tnwnxsqln1rv0/fglyq3ef2so2kw debug1:可以继续的身份验证:公钥 debug1:正在尝试私钥:/home/clive/.ssh/id\u ed25519\u sk debug1:正在尝试私钥:/home/clive/.ssh/id\u xmss debug1:不再尝试验证方法。 clive@134.209.151.146:权限被拒绝(公钥)。

Linux I';我无法ssh到DigitalOcean Ubuntu(20.04)服务器?我的sshd_配置和授权_密钥文件似乎还可以。详情如下 OpenSSH_8.6p1,OpenSSL 1.1.1k 2021年3月25日 debug1:读取配置数据/etc/ssh/ssh\u config debug1:连接到134.209.151.146[134.209.151.146]端口22。 debug1:已建立连接。 debug1:identity file/home/clive/.ssh/id\u rsa type-1 debug1:identity file/home/clive/.ssh/id\u rsa-cert类型-1 debug1:identity file/home/clive/.ssh/id_dsa type-1 debug1:identity file/home/clive/.ssh/id_dsa-cert type-1 debug1:identity file/home/clive/.ssh/id_ecdsa type-1 debug1:identity file/home/clive/.ssh/id_ecdsa-cert type-1 debug1:identity file/home/clive/.ssh/id\u ecdsa\u sk type-1 debug1:identity file/home/clive/.ssh/id\u ecdsa\u sk-cert type-1 debug1:identity file/home/clive/.ssh/id_ed25519类型3 debug1:identity file/home/clive/.ssh/id_ed25519-cert type-1 debug1:identity file/home/clive/.ssh/id_ed25519_sk type-1 debug1:identity file/home/clive/.ssh/id_ed25519_sk-cert type-1 debug1:identity file/home/clive/.ssh/id\u xmss type-1 debug1:identity file/home/clive/.ssh/id\u xmss-cert type-1 debug1:本地版本字符串SSH-2.0-OpenSSH_8.6 debug1:远程协议版本2.0,远程软件版本OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 debug1:compat_横幅:匹配:OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH*compat 0x04000000 debug1:将134.209.151.146:22验证为“clive” debug1:load_hostkeys:fopen/home/clive/.ssh/known_hosts2:没有这样的文件或目录 debug1:加载\u主机密钥:fopen/etc/ssh/ssh\u已知\u主机:没有这样的文件或目录 debug1:load_hostkey:fopen/etc/ssh/ssh_known_hosts2:没有这样的文件或目录 debug1:SSH2\u MSG\u KEXINIT已发送 debug1:SSH2\u MSG\u KEXINIT已收到 debug1:kex:算法:curve25519-sha256 debug1:kex:主机密钥算法:ssh-ed25519 debug1:kex:server->client cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:kex:client->server cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:需要SSH2\u MSG\u KEX\u ECDH\u回复 调试1:收到SSH2\u消息\u KEX\u ECDH\u回复 debug1:服务器主机密钥:ssh-ed25519 SHA256:X9T8dMRejOJgTDfHZo5kRvoVTD1moCRzX0F2jJmgGRk debug1:load_hostkeys:fopen/home/clive/.ssh/known_hosts2:没有这样的文件或目录 debug1:加载\u主机密钥:fopen/etc/ssh/ssh\u已知\u主机:没有这样的文件或目录 debug1:load_hostkey:fopen/etc/ssh/ssh_known_hosts2:没有这样的文件或目录 debug1:主机“134.209.151.146”已知,并且与ED25519主机密钥匹配。 debug1:在/home/clive/.ssh/known_hosts中找到密钥:2 debug1:在134217728块之后重新键入 debug1:SSH2\u MSG\u已发送新密钥 debug1:应为SSH2\u MSG\u NEWKEYS debug1:SSH2\u MSG\u接收到新密钥 debug1:在134217728块之后重新输入 debug1:将尝试密钥:/home/clive/.ssh/id\u rsa debug1:将尝试密钥:/home/clive/.ssh/id\u debug1:将尝试密钥:/home/clive/.ssh/id\u ecdsa debug1:将尝试密钥:/home/clive/.ssh/id\u ecdsa\u sk debug1:将尝试键:/home/clive/.ssh/id_ed25519 ed25519 SHA256:808r4drp8tnwnxsqln1rv0/fglyq3ef2so2kw debug1:将尝试密钥:/home/clive/.ssh/id\u ed25519\u sk debug1:将尝试键:/home/clive/.ssh/id\u xmss debug1:SSH2\u MSG\u EXT\u接收到信息 debug1:kex_输入_外部_信息:服务器信号algs= debug1:SSH2\u消息\u服务\u接收 debug1:可以继续的身份验证:公钥 debug1:下一个身份验证方法:公钥 debug1:正在尝试私钥:/home/clive/.ssh/id\u rsa debug1:正在尝试私钥:/home/clive/.ssh/id\u dsa debug1:正在尝试私钥:/home/clive/.ssh/id\u ecdsa debug1:正在尝试私钥:/home/clive/.ssh/id\u ecdsa\u sk debug1:提供公钥:/home/clive/.ssh/id_ed25519 ed25519 SHA256:808r4drp8tnwnxsqln1rv0/fglyq3ef2so2kw debug1:可以继续的身份验证:公钥 debug1:正在尝试私钥:/home/clive/.ssh/id\u ed25519\u sk debug1:正在尝试私钥:/home/clive/.ssh/id\u xmss debug1:不再尝试验证方法。 clive@134.209.151.146:权限被拒绝(公钥)。,linux,ubuntu,ssh,terminal,digital-ocean,Linux,Ubuntu,Ssh,Terminal,Digital Ocean,有人能帮我弄清楚吗?我正在尝试禁用密码并在更新授权密钥文件后重新连接,但这是每当我将PasswordAuthentication标志设置为no时出现的错误。我已尝试执行ssh copy id-I~/.ssh/test2.pubusername@hostip其中test2是新生成的发布id。我有点不知道从哪里开始。我的本地计算机似乎找不到名为known_hosts2的文件夹,但我知道如何进一步操作。 您是否使用属性密钥(例如sh copy id-i~/.ssh/test2)连接username@h

有人能帮我弄清楚吗?我正在尝试禁用密码并在更新授权密钥文件后重新连接,但这是每当我将PasswordAuthentication标志设置为no时出现的错误。我已尝试执行
ssh copy id-I~/.ssh/test2.pubusername@hostip
其中test2是新生成的发布id。我有点不知道从哪里开始。我的本地计算机似乎找不到名为known_hosts2的文件夹,但我知道如何进一步操作。

  • 您是否使用属性密钥(例如
    sh copy id-i~/.ssh/test2)连接username@hostip
  • 如果您的密钥位于
    /home/clive/.ssh/authorized keys
  • 文件是否得到了充分的保护
例如:

chmod 700.ssh
chmod 600.ssh/authorized_密钥
还要检查服务器端调试日志(通常在
/var/log
中),以了解导致登录失败的原因

OpenSSH_8.6p1, OpenSSL 1.1.1k  25 Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 134.209.151.146 [134.209.151.146] port 22.
debug1: Connection established.
debug1: identity file /home/clive/.ssh/id_rsa type -1
debug1: identity file /home/clive/.ssh/id_rsa-cert type -1
debug1: identity file /home/clive/.ssh/id_dsa type -1
debug1: identity file /home/clive/.ssh/id_dsa-cert type -1
debug1: identity file /home/clive/.ssh/id_ecdsa type -1
debug1: identity file /home/clive/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/clive/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/clive/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/clive/.ssh/id_ed25519 type 3
debug1: identity file /home/clive/.ssh/id_ed25519-cert type -1
debug1: identity file /home/clive/.ssh/id_ed25519_sk type -1
debug1: identity file /home/clive/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/clive/.ssh/id_xmss type -1
debug1: identity file /home/clive/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: compat_banner: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 134.209.151.146:22 as 'clive'
debug1: load_hostkeys: fopen /home/clive/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:X9T8dMRejOJgTDfHZo5kRvoVTD1moCRzX0F2jJmgGRk
debug1: load_hostkeys: fopen /home/clive/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '134.209.151.146' is known and matches the ED25519 host key.
debug1: Found key in /home/clive/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/clive/.ssh/id_rsa
debug1: Will attempt key: /home/clive/.ssh/id_dsa
debug1: Will attempt key: /home/clive/.ssh/id_ecdsa
debug1: Will attempt key: /home/clive/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/clive/.ssh/id_ed25519 ED25519 SHA256:808r4DrP8TnWnnXssQLn1rV0/fgWlyq3eF2s4Po2KZw
debug1: Will attempt key: /home/clive/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/clive/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/clive/.ssh/id_rsa
debug1: Trying private key: /home/clive/.ssh/id_dsa
debug1: Trying private key: /home/clive/.ssh/id_ecdsa
debug1: Trying private key: /home/clive/.ssh/id_ecdsa_sk
debug1: Offering public key: /home/clive/.ssh/id_ed25519 ED25519 SHA256:808r4DrP8TnWnnXssQLn1rV0/fgWlyq3eF2s4Po2KZw
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/clive/.ssh/id_ed25519_sk
debug1: Trying private key: /home/clive/.ssh/id_xmss
debug1: No more authentication methods to try.
clive@134.209.151.146: Permission denied (publickey).