Cloud66 cx 命令返回退出状态 255/权限被拒绝(公钥)

Cloud66 cx 命令返回退出状态 255/权限被拒绝(公钥)

我正在尝试通过以下方式连接到我的 Cloud66 服务器

cx ssh -s 'My First Server' -e staging chimpanzee

我正在接收exit status 255

我尝试通过 ssh 连接:

ssh [email protected] -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -o LogLevel=VERBOSE -o IdentitiesOnly=yes -A -p 22

我收到了Permission denied (publickey)

如果我运行cat ~/.ssh/id_rsa.pubcx ssh-config get-public-key我会看到相同的公钥保存在我的本地机器和 Cloud66 设置中。

我也尝试了调试命令:

CXDEBUG=1 cx ssh -s 'My First Server' -e staging chimpanzee

返回(仅最后几行输出):

HTTP/2.0 200 OK
Content-Length: 285
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Fri, 12 May 2023 10:31:57 GMT
Etag: W/"a433329562d9be4513f8089812fcde3f"
Via: 1.1 google
X-Request-Id: aa6d6404-6515-4b76-8961-45b3935cfb82
X-Runtime: 0.054774

{"response":{"id":53**188,"user":"****","resource_type":"stack","action":"open_lease","resource_id":"80749","started_via":"api","started_at":"2023-05-12T10:31:57Z","finished_at":"2023-05-12T10:31:57Z","finished_success":true,"finished_message":null,"finished_result":null}}
Running Command /usr/bin/ssh with ([-o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -o LogLevel=QUIET -A -p 22 klem*****21@***.***.187])
2023/05/12 12:31:58 error: If you're having issues connecting to your server, you may find some help at https://help.cloud66.com/docs/servers/ssh-to-server
2023/05/12 12:31:58 error: exit status 255
cx  ssh --vvv -s 'My First Server' -e staging chimpanzee
Server: chimpanzee (134.***.***.187)
Creating temporary firewall lease from [here] to 134.***.***.187
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug2: resolve_canonicalize: hostname 134.***.***.187 is address
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to 134.***.***.187 [134.***.***.187] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: Connection established.
debug1: identity file /Users/knagode/.ssh/id_rsa type 0
debug1: identity file /Users/knagode/.ssh/id_rsa-cert type -1
debug1: identity file /Users/knagode/.ssh/id_ecdsa type -1
debug1: identity file /Users/knagode/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/knagode/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/knagode/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/knagode/.ssh/id_ed25519 type -1
debug1: identity file /Users/knagode/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/knagode/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/knagode/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/knagode/.ssh/id_xmss type -1
debug1: identity file /Users/knagode/.ssh/id_xmss-cert type -1
debug1: identity file /Users/knagode/.ssh/id_dsa type -1
debug1: identity file /Users/knagode/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3ubuntu0.1
debug1: compat_banner: match: OpenSSH_8.9p1 Ubuntu-3ubuntu0.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 134.***.***.187:22 as 'klemen521'
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
debug3: order_hostkeyalgs: no algorithms matched; accept original
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,[email protected],diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:QefnnUN0Sfb2OhWOCjO9Gd5Q3hmU6JTqTDMbwLDsmaM
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
Warning: Permanently added '134.***.***.187' (ED25519) to the list of known hosts.
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/knagode/.ssh/id_rsa RSA SHA256:v9haW9RW6vwgeaQkRZSJOnEpDIuJu4yeut4KIz3zijg
debug1: Will attempt key: /Users/knagode/.ssh/id_ecdsa
debug1: Will attempt key: /Users/knagode/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/knagode/.ssh/id_ed25519
debug1: Will attempt key: /Users/knagode/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/knagode/.ssh/id_xmss
debug1: Will attempt key: /Users/knagode/.ssh/id_dsa
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected]=<0>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/knagode/.ssh/id_rsa RSA SHA256:v9haW9RW6vwgeaQkRZSJOnEpDIuJu4yeut4KIz3zijg
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: /Users/knagode/.ssh/id_ecdsa
debug3: no such identity: /Users/knagode/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/knagode/.ssh/id_ecdsa_sk
debug3: no such identity: /Users/knagode/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /Users/knagode/.ssh/id_ed25519
debug3: no such identity: /Users/knagode/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /Users/knagode/.ssh/id_ed25519_sk
debug3: no such identity: /Users/knagode/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /Users/knagode/.ssh/id_xmss
debug3: no such identity: /Users/knagode/.ssh/id_xmss: No such file or directory
debug1: Trying private key: /Users/knagode/.ssh/id_dsa
debug3: no such identity: /Users/knagode/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
klemen521@134.***.***.187: Permission denied (publickey).

看来我的~/.ssh/id_rsa还没有被识别。

文件夹权限:

ls -ld ~/.ssh
=> drwx------  5 knagode  staff  160 Apr 28 19:28 /Users/knagode/.ssh


ls -ld ~/
drwxr-x---+ 77 knagode  staff  2464 May 12 13:04 /Users/knagode/

知道我还能尝试什么吗?

答案1

我希望你现在已经解决了它。

在此记录一下:就我而言,我创建了一个特定的 ssh 密钥,我只想将其用于这个项目,无论我向 ssh (-i) 传递什么选项,它都不会识别该身份。我不得不恢复使用我的主要 rsa 密钥,这是 ssh 识别的密钥。

相关内容