fail to parse public key: exit status 255 - ssh-keygen: /tmp/58593068/id_rsa.pub: Permission denied

在Centos环境中部署Gogs时遇到添加SSH密钥失败的问题,错误信息显示权限拒绝。通过调整SELinux模式至Permissive,成功解决了密钥添加问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在使用Centos搭建gogs时,当我在添加ssh密钥的时候
在这里插入图片描述
出现以下错误:
在这里插入图片描述
错误日志如下:
2019/11/28 09:14:11 [ERROR] [...g/context/context.go:171 ServerError()] AddPublicKey: addKey: fail to parse public key: exit status 255 - ssh-keygen: /tmp/585930689/id_rsa.pub: Permission denied

经过反复检查,也试了很多网上说的办法,依旧不通。
后来发现这是台新服务器,没有设置过SELinux,所以在这里,我们禁用SELinux即可。
关闭方式如下:
1、临时关闭(不用重启机器):

setenforce 0   # SELinux 成为permissive模式
setenforce 1   # 设置SELinux 成为enforcing模式

2、修改配置文件,需要重启机器生效:

修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled

检查状态:

getenforce   # 检查状态  
# Disabled 代表 SELinux 被禁用,Permissive 代表仅记录安全警告但不阻止可疑行为,Enforcing 代表记录警告且阻止可疑行为

我这里设置为Permissive即可成功添加ssh密钥。

sftp -vvv sftp_dy@localhost debug3: spawning "C:\\Program Files\\OpenSSH\\ssh.exe" "-oForwardX11 no" "-oPermitLocalCommand no" "-oClearAllForwardings yes" -v -v -v "-oForwardAgent no" -l sftp_dy -s -- localhost sftp as subprocess OpenSSH_for_Windows_9.8p2 Win32-OpenSSH-GitHub, LibreSSL 4.0.0 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/config error:2 debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2 debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\zwx1262540/.ssh/known_hosts' debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\zwx1262540/.ssh/known_hosts2' debug2: resolving "localhost" port 22 debug3: resolve_host: lookup localhost:22 debug3: channel_clear_timeouts: clearing debug3: ssh_connect_direct: entering debug1: Connecting to localhost [127.0.0.1] port 22. debug1: Connection established. debug1: identity file C:\\Users\\zwx1262540/.ssh/id_rsa type 0 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_rsa-cert error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_rsa-cert.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_rsa-cert error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_rsa-cert type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ecdsa type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa-cert error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa-cert.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa-cert error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ecdsa-cert type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa_sk error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa_sk.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa_sk error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ecdsa_sk type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa_sk-cert error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa_sk-cert.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ecdsa_sk-cert error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ed25519 type 3 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519-cert error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519-cert.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519-cert error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ed25519-cert type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519_sk error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519_sk.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519_sk error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ed25519_sk type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519_sk-cert error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519_sk-cert.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_ed25519_sk-cert error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_ed25519_sk-cert type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_xmss error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_xmss.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_xmss error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_xmss type -1 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_xmss-cert error:2 debug3: Failed to open file:C:/Users/zwx1262540/.ssh/id_xmss-cert.pub error:2 debug3: failed to open file:C:/Users/zwx1262540/.ssh/id_xmss-cert error:2 debug1: identity file C:\\Users\\zwx1262540/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.8 Win32-OpenSSH-GitHub debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_9.8 Win32-OpenSSH-GitHub debug1: compat_banner: match: OpenSSH_for_Windows_9.8 Win32-OpenSSH-GitHub pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to localhost:22 as 'sftp_dy' debug3: record_hostkey: found key type ECDSA in file C:\\Users\\zwx1262540/.ssh/known_hosts:2 debug3: load_hostkeys_file: loaded 1 keys from localhost debug3: Failed to open file:C:/Users/zwx1262540/.ssh/known_hosts2 error:2 debug1: load_hostkeys: fopen C:\\Users\\zwx1262540/.ssh/known_hosts2: No such file or directory debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2 debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2 debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp384 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: curve25519-sha256,curve25519-sha256@libssh.org,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,kex-strict-c-v00@openssh.com debug2: host key algorithms: ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp384,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,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,curve25519-sha256@libssh.org,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-s,kex-strict-s-v00@openssh.com debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp384,ssh-ed25519 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug3: kex_choose_conf: will use strict KEX ordering debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp384 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 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: ecdsa-sha2-nistp384 SHA256:UyANwfU8ig+Uf3gKnpza2NfNH19MfjRQxURpwC7ou0U debug3: record_hostkey: found key type ECDSA in file C:\\Users\\zwx1262540/.ssh/known_hosts:2 debug3: load_hostkeys_file: loaded 1 keys from localhost debug3: Failed to open file:C:/Users/zwx1262540/.ssh/known_hosts2 error:2 debug1: load_hostkeys: fopen C:\\Users\\zwx1262540/.ssh/known_hosts2: No such file or directory debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2 debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2 debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory debug1: Host 'localhost' is known and matches the ECDSA host key. debug1: Found key in C:\\Users\\zwx1262540/.ssh/known_hosts:2 debug3: send packet: type 21 debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 debug2: ssh_set_newkeys: mode 1 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: Sending SSH2_MSG_EXT_INFO debug3: send packet: type 7 debug1: expecting SSH2_MSG_NEWKEYS debug3: receive packet: type 21 debug1: ssh_packet_read_poll2: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug2: ssh_set_newkeys: mode 0 debug1: rekey in after 134217728 blocks debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,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,kex-strict-c-v00@openssh.com debug2: host key algorithms: ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp384,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,zlib debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug3: send packet: type 5 debug3: receive packet: type 7 debug1: SSH2_MSG_EXT_INFO received debug3: kex_input_ext_info: extension server-sig-algs debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256> debug3: kex_input_ext_info: extension publickey-hostbound@openssh.com debug1: kex_ext_info_check_ver: publickey-hostbound@openssh.com=<0> debug3: kex_input_ext_info: extension ping@openssh.com debug1: kex_ext_info_check_ver: ping@openssh.com=<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 7 debug1: SSH2_MSG_EXT_INFO received debug3: kex_input_ext_info: extension server-sig-algs debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256> debug3: receive packet: type 51 debug1: Authentications that can continue: password debug3: start over, passed a different list password debug3: preferred publickey,keyboard-interactive,password debug3: authmethod_lookup password debug3: remaining preferred: ,keyboard-interactive,password debug3: authmethod_is_enabled password debug1: Next authentication method: password sftp_dy@localhost's password: debug3: send packet: type 50 debug2: we sent a password packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: password Permission denied, please try again. sftp_dy@localhost's password: debug3: send packet: type 50 debug2: we sent a password packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: password Permission denied, please try again.
06-10
scp -vvv -o PreferredAuthentications=publickey -oHostKeyAlgorithms=+ssh-rsa -oHostKeyAlgorithms=ssh-rsa -i /home/rataneodsftp/.ssh/id_rsa test.csv cciladmin@172.26.26.237:C:\\MXCCILFRSGIFTCITY\\unsent Executing: program /usr/bin/ssh host 172.26.26.237, user cciladmin, command scp -v -t C:\MXCCILFRSGIFTCITY\unsent OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021 debug1: Reading configuration data /etc/ssh/ssh_config debug3: /etc/ssh/ssh_config line 52: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0 debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf debug2: checking match for 'final all' host 172.26.26.237 originally 172.26.26.237 debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: not matched 'final' debug2: match not found debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only) debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-] debug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512] debug1: configuration requests final Match pass debug2: resolve_canonicalize: hostname 172.26.26.237 is address debug1: re-parsing configuration debug1: Reading configuration data /etc/ssh/ssh_config debug3: /etc/ssh/ssh_config line 52: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0 debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf debug2: checking match for 'final all' host 172.26.26.237 originally 172.26.26.237 debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: matched 'final' debug2: match found debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-] debug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512] debug2: ssh_connect_direct debug1: Connecting to 172.26.26.237 [172.26.26.237] port 22. debug1: Connection established. debug1: identity file /home/rataneodsftp/.ssh/id_rsa type 0 debug1: identity file /home/rataneodsftp/.ssh/id_rsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.0 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_9.5 debug1: match: OpenSSH_for_Windows_9.5 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to 172.26.26.237:22 as 'cciladmin' 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: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ext-info-c,kex-strict-c-v00@openssh.com debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa debug2: ciphers ctos: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc debug2: ciphers stoc: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,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,curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group16-sha512,diffie-hellman-group-exchange-sha256,kex-strict-s-v00@openssh.com debug2: host key algorithms: ssh-ed25519 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug3: will use strict KEX ordering debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: curve25519-sha256 need=32 dh_need=32 debug1: kex: curve25519-sha256 need=32 dh_need=32 debug3: send packet: type 30 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug3: receive packet: type 31 debug1: Server host key: ssh-ed25519 SHA256:9lZLI0U3Z1VQ1c27zyZuhyjIIsvYtYf0R8UvBPCqNQ0 debug3: hostkeys_foreach: reading file "/home/rataneodsftp/.ssh/known_hosts" debug3: record_hostkey: found key type ED25519 in file /home/rataneodsftp/.ssh/known_hosts:36 debug3: load_hostkeys: loaded 1 keys from 172.26.26.237 debug1: Host '172.26.26.237' is known and matches the ED25519 host key. debug1: Found key in /home/rataneodsftp/.ssh/known_hosts:36 debug3: send packet: type 21 debug1: resetting send seqnr 3 debug2: set_newkeys: mode 1 debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug3: receive packet: type 21 debug1: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug2: set_newkeys: mode 0 debug1: rekey in after 4294967296 blocks debug1: Will attempt key: /home/rataneodsftp/.ssh/id_rsa RSA SHA256:CHalTQ+japBghp74FxdPQGg1dqm1M8WQXBTbqGXl6i8 explicit 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,sk-ssh-ed25519@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com,ssh-dss,ssh-rsa,rsa-sha2-256,rsa-sha2-512> debug1: kex_input_ext_info: publickey-hostbound@openssh.com (unrecognised) debug1: kex_input_ext_info: ping@openssh.com (unrecognised) 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 53 debug3: input_userauth_banner ######################################################################### # This computer system, its network and data contained therein # # is the property of the Standard Chartered Group. Access to # # this computer and network is restricted to persons and programs # # authorised by the Group only. # # # # Access by others is prohibited and unauthorised, and is wrongful # # under law. Do not proceed if you are not authorised. Any # # unauthorised access will be prosecuted to the fullest extent of # # the law. # ######################################################################### debug3: receive packet: type 51 debug1: Authentications that can continue: password debug3: start over, passed a different list password debug3: preferred publickey debug1: No more authentication methods to try. cciladmin@172.26.26.237: Permission denied (password). lost connection
06-11
scp -vvv -oHostKeyAlgorithms=+ssh-rsa -oHostKeyAlgorithms=ssh-rsa -i /home/rataneodsftp/.ssh/id_rsa test.csv cciladmin@172.26.26.237:C:\\MXCCILFRSGIFTCITY\\unsent Executing: program /usr/bin/ssh host 172.26.26.237, user cciladmin, command scp -v -t C:\MXCCILFRSGIFTCITY\unsent OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021 debug1: Reading configuration data /etc/ssh/ssh_config debug3: /etc/ssh/ssh_config line 52: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0 debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf debug2: checking match for 'final all' host 172.26.26.237 originally 172.26.26.237 debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: not matched 'final' debug2: match not found debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only) debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-] debug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512] debug1: configuration requests final Match pass debug2: resolve_canonicalize: hostname 172.26.26.237 is address debug1: re-parsing configuration debug1: Reading configuration data /etc/ssh/ssh_config debug3: /etc/ssh/ssh_config line 52: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0 debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf debug2: checking match for 'final all' host 172.26.26.237 originally 172.26.26.237 debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: matched 'final' debug2: match found debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-] debug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512] debug2: ssh_connect_direct debug1: Connecting to 172.26.26.237 [172.26.26.237] port 22. debug1: Connection established. debug1: identity file /home/rataneodsftp/.ssh/id_rsa type 0 debug1: identity file /home/rataneodsftp/.ssh/id_rsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.0 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_9.5 debug1: match: OpenSSH_for_Windows_9.5 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to 172.26.26.237:22 as 'cciladmin' 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: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ext-info-c,kex-strict-c-v00@openssh.com debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa debug2: ciphers ctos: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc debug2: ciphers stoc: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,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,curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group16-sha512,diffie-hellman-group-exchange-sha256,kex-strict-s-v00@openssh.com debug2: host key algorithms: ssh-ed25519 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug3: will use strict KEX ordering debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: curve25519-sha256 need=32 dh_need=32 debug1: kex: curve25519-sha256 need=32 dh_need=32 debug3: send packet: type 30 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug3: receive packet: type 31 debug1: Server host key: ssh-ed25519 SHA256:9lZLI0U3Z1VQ1c27zyZuhyjIIsvYtYf0R8UvBPCqNQ0 debug3: hostkeys_foreach: reading file "/home/rataneodsftp/.ssh/known_hosts" debug3: record_hostkey: found key type ED25519 in file /home/rataneodsftp/.ssh/known_hosts:36 debug3: load_hostkeys: loaded 1 keys from 172.26.26.237 debug1: Host '172.26.26.237' is known and matches the ED25519 host key. debug1: Found key in /home/rataneodsftp/.ssh/known_hosts:36 debug3: send packet: type 21 debug1: resetting send seqnr 3 debug2: set_newkeys: mode 1 debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug3: receive packet: type 21 debug1: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug2: set_newkeys: mode 0 debug1: rekey in after 4294967296 blocks debug1: Will attempt key: /home/rataneodsftp/.ssh/id_rsa RSA SHA256:CHalTQ+japBghp74FxdPQGg1dqm1M8WQXBTbqGXl6i8 explicit 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,sk-ssh-ed25519@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com,ssh-dss,ssh-rsa,rsa-sha2-256,rsa-sha2-512> debug1: kex_input_ext_info: publickey-hostbound@openssh.com (unrecognised) debug1: kex_input_ext_info: ping@openssh.com (unrecognised) 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 53 debug3: input_userauth_banner ######################################################################### # This computer system, its network and data contained therein # # is the property of the Standard Chartered Group. Access to # # this computer and network is restricted to persons and programs # # authorised by the Group only. # # # # Access by others is prohibited and unauthorised, and is wrongful # # under law. Do not proceed if you are not authorised. Any # # unauthorised access will be prosecuted to the fullest extent of # # the law. # ######################################################################### debug3: receive packet: type 51 debug1: Authentications that can continue: password debug3: start over, passed a different list password debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup password debug3: remaining preferred: ,publickey,keyboard-interactive,password debug3: authmethod_is_enabled password debug1: Next authentication method: password cciladmin@172.26.26.237's password:
06-11
vsode用ssh连接linux失败,如何解决?17:00:24.714] Log Level: 2 [17:00:24.716] remote-ssh@0.90.1 [17:00:24.716] win32 x64 [17:00:24.723] SSH Resolver called for "ssh-remote+112.74.167.19", attempt 1 [17:00:24.724] "remote.SSH.useLocalServer": false [17:00:24.724] "remote.SSH.showLoginTerminal": false [17:00:24.724] "remote.SSH.remotePlatform": {} [17:00:24.724] "remote.SSH.path": [17:00:24.724] "remote.SSH.configFile": [17:00:24.724] "remote.SSH.useFlock": true [17:00:24.724] "remote.SSH.lockfilesInTmp": false [17:00:24.725] "remote.SSH.localServerDownload": auto [17:00:24.725] "remote.SSH.remoteServerListenOnSocket": false [17:00:24.725] "remote.SSH.showLoginTerminal": false [17:00:24.725] "remote.SSH.defaultExtensions": [] [17:00:24.725] "remote.SSH.loglevel": 2 [17:00:24.725] "remote.SSH.enableDynamicForwarding": true [17:00:24.725] "remote.SSH.enableRemoteCommand": false [17:00:24.725] "remote.SSH.serverPickPortsFromRange": {} [17:00:24.726] "remote.SSH.serverInstallPath": {} [17:00:24.740] SSH Resolver called for host: 112.74.167.19 [17:00:24.740] Setting up SSH remote "112.74.167.19" [17:00:24.750] Using commit id "488a1f239235055e34e673291fb8d8c810886f81" and quality "stable" for server [17:00:24.752] Install and start server if needed [17:00:26.426] Checking ssh with "ssh -V" [17:00:26.561] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2 [17:00:26.567] Running script with connection command: ssh -T -D 49736 "112.74.167.19" bash [17:00:26.572] Terminal shell path: C:\WINDOWS\System32\cmd.exe [17:00:27.229] > [?9001h[?1004h [17:00:27.229] Got some output, clearing connection timeout [17:00:27.560] > user@112.74.167.19's password:]0;C:\WINDOWS\System32\cmd.exe [17:00:27.561] Showing password prompt [17:00:41.299] Got password response [17:00:41.299] "install" wrote data to terminal: "***********" [17:00:41.323] > [17:00:43.057] > Permission denied, please try again. [17:00:43.100] > user@112.74.167.19's password: [17:00:43.100] Showing password prompt [17:01:26.532] Got password response [17:01:26.532] "install" wrote data to terminal: "***********" [17:01:26.569] > [17:01:29.136] > Permission denied, please try again. [17:01:29.150] > user@112.74.167.19's password: [17:01:29.150] Showing password prompt [17:01:30.214] Got password response [17:01:30.214] "install" wrote data to terminal: "***********" [17:01:30.242] > [17:01:32.213] > user@112.74.167.19: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). [17:01:32.242] > 过程试图写入的管道不存在。 [17:01:33.575] "install" terminal command done [17:01:33.576] Install terminal quit with output: 过程试图写入的管道不存在。 [17:01:33.576] Received install output: 过程试图写入的管道不存在。 [17:01:33.576] Failed to parse remote port from server output [17:01:33.577] Resolver error: Error at g.Create (c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:585160) at t.handleInstallOutput (c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:583812) at t.tryInstall (c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:680961) at async c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:643846 at async t.withShowDetailsEvent (c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:647162) at async t.resolve (c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:644896) at async c:\Users\forest\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:726855 [17:01:33.581] ------
08-06
GJCKGD09064:~ 10280281$ ssh -Tv git@gitlab.com OpenSSH_9.9p1, LibreSSL 3.3.6 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Reading configuration data /etc/ssh/ssh_config.d/100-macos.conf debug1: /etc/ssh/ssh_config.d/100-macos.conf line 1: Applying options for * debug1: Reading configuration data /etc/ssh/crypto.conf debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling debug1: Connecting to gitlab.com port 22. debug1: Connection established. debug1: identity file /Users/10280281/.ssh/id_rsa type -1 debug1: identity file /Users/10280281/.ssh/id_rsa-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa_sk type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ed25519 type 3 debug1: identity file /Users/10280281/.ssh/id_ed25519-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ed25519_sk type -1 debug1: identity file /Users/10280281/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /Users/10280281/.ssh/id_xmss type -1 debug1: identity file /Users/10280281/.ssh/id_xmss-cert type -1 debug1: identity file /Users/10280281/.ssh/id_dsa type -1 debug1: identity file /Users/10280281/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_9.9 debug1: Remote protocol version 2.0, remote software version GitLab-SSHD debug1: compat_banner: no match: GitLab-SSHD debug1: Authenticating to gitlab.com:22 as 'git' debug1: load_hostkeys: fopen /Users/10280281/.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: ecdh-sha2-nistp256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: aes128-gcm@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:eUXGGm1YGsMAS7vkcx6JOJdOGHPem5gQp4taiCfCLB8 debug1: load_hostkeys: fopen /Users/10280281/.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 'gitlab.com' is known and matches the ED25519 host key. debug1: Found key in /Users/10280281/.ssh/known_hosts:2 debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: ssh_packet_read_poll2: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 4294967296 blocks debug1: SSH2_MSG_EXT_INFO received debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss> debug1: kex_ext_info_check_ver: ping@openssh.com=<0> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: get_agent_identities: bound agent to hostkey debug1: get_agent_identities: agent returned 1 keys debug1: Will attempt key: /Users/10280281/.ssh/id_ed25519 ED25519 SHA256:SuAWMQGFny0Fbbb0v4XrQfli2ahKRO7GFDPQ+kRiSUU agent debug1: Will attempt key: /Users/10280281/.ssh/id_rsa debug1: Will attempt key: /Users/10280281/.ssh/id_ecdsa debug1: Will attempt key: /Users/10280281/.ssh/id_ecdsa_sk debug1: Will attempt key: /Users/10280281/.ssh/id_ed25519_sk debug1: Will attempt key: /Users/10280281/.ssh/id_xmss debug1: Will attempt key: /Users/10280281/.ssh/id_dsa debug1: Offering public key: /Users/10280281/.ssh/id_ed25519 ED25519 SHA256:SuAWMQGFny0Fbbb0v4XrQfli2ahKRO7GFDPQ+kRiSUU agent debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/10280281/.ssh/id_rsa debug1: Trying private key: /Users/10280281/.ssh/id_ecdsa debug1: Trying private key: /Users/10280281/.ssh/id_ecdsa_sk debug1: Trying private key: /Users/10280281/.ssh/id_ed25519_sk debug1: Trying private key: /Users/10280281/.ssh/id_xmss debug1: Trying private key: /Users/10280281/.ssh/id_dsa debug1: No more authentication methods to try. git@gitlab.com: Permission denied (publickey).
最新发布
08-14
<think>根据用户提供的SSH连接调试日志(ssh -Tv git@gitlab.com),可以分析出以下关键信息: 1. **密钥尝试过程**: - 客户端依次尝试了多种密钥类型(id_rsa, id_ecdsa, id_ed25519等) - 唯一检测到的有效密钥是:`/Users/10280281/.ssh/id_ed25519` -密钥被提交后服务器返回:`Authentications that can continue: publickey`(即认证未通过) 2. **失败原因**: - 虽然客户端提供了`id_ed25519`密钥,但服务器未接受 - 可能原因: - 该公钥未添加到GitLab账户 - 密钥文件权限问题 - SSH代理未正确加载密钥 3. **日志关键行分析**: ```log debug1: Offering public key: .../id_ed25519 ... agent # 密钥被提交 debug1: Authentications that can continue: publickey # 认证被拒绝 ``` ### 解决方案 #### 步骤1:确认公钥是否添加到GitLab 1. 检查公钥内容: ```bash cat ~/.ssh/id_ed25519.pub ``` - 确认输出以`ssh-ed25519 AAAAC3...`开头,包含正确邮箱 2. 登录GitLab → **Preferences** → **SSH Keys**: - 检查是否存在完全相同的公钥 - 如存在先删除旧密钥,重新添加 #### 步骤2:检查密钥权限 ```bash # 修复权限(在密钥所在目录执行) chmod 700 ~/.ssh chmod 600 ~/.ssh/id_ed25519* ``` #### 步骤3:强制SSH使用指定密钥 ```bash # 通过-i参数指定密钥路径 ssh -T -i ~/.ssh/id_ed25519 git@gitlab.com ``` #### 步骤4:检查SSH代理状态 ```bash # 查看已加载密钥 ssh-add -l # 若未加载则添加 eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 ``` #### 步骤5:配置SSH客户端(可选) 在`~/.ssh/config`中添加: ```config Host gitlab.com HostName gitlab.com User git IdentityFile ~/.ssh/id_ed25519 IdentitiesOnly yes # 强制只使用指定密钥 ``` ### 高级排查 若仍失败,检查GitLab的SSH密钥限制: 1. 进入GitLab账户 → **Settings** → **SSH Keys** 2. 查看密钥的"Usage"是否包含"GitLab" 3. 检查密钥的"Expiration date"是否过期 §§相关问题§§ 1.SSH连接出现"Authentications that can continue: publickey"时,除了密钥未添加外还有哪些可能原因? 2. 如何在SSH客户端配置中针对不同Git平台(如GitHub和GitLab)使用不同的密钥对? 3. 如果SSH密钥设置了passphrase,如何避免每次操作都需要手动输入密码? 4. 为什么在MacOS系统中SSH密钥需要添加到密钥链(Keychain)管理?如何操作? 5. 当企业GitLab实例使用自定义SSH端口时,SSH客户端配置需要如何调整?</think>根据您提供的 SSH 调试日志(`ssh -Tv git@gitlab.com`),以下是详细分析和解决方案: ### 问题诊断(关键日志分析) 1. **密钥尝试过程**: ```log debug1: Will attempt key: /Users/10280281/.ssh/id_ed25519 ED25519 SHA256:SuAWMQGFny0Fbbb0v4XrQfli2ahKRO7GFDPQ+kRiSUU agent debug1: Offering public key: ... agent debug1: Authentications that can continue: publickey ``` - 系统检测到 `id_ed25519` 密钥但认证失败 - 服务器拒绝了所有密钥尝试 2. **核心问题**: - 密钥文件未正确加载到 SSH 代理 - 公钥未添加到 GitLab 账户或未完整复制 - 密钥权限配置错误(MacOS 常见问题) --- ### 解决方案 #### 步骤1:重新添加密钥SSH 代理 ```bash # 确保代理运行 eval "$(ssh-agent -s)" # 删除所有缓存密钥 ssh-add -D # 添加新密钥(需输入密码) ssh-add ~/.ssh/id_ed25519 # 验证是否添加成功 ssh-add -l # 应显示密钥指纹 ``` #### 步骤2:检查公钥内容 ```bash # 确认公钥完整复制(特别是首尾无空格) cat ~/.ssh/id_ed25519.pub | pbcopy # MacOS 复制到剪贴板 ``` 1. 登录 GitLab → **Preferences → SSH Keys** 2. 删除现有密钥 3. 重新粘贴公钥(确保以 `ssh-ed25519 AAAAC3...` 开头) #### 步骤3:修复文件权限 ```bash chmod 700 ~/.ssh chmod 600 ~/.ssh/id_ed25519* chmod 644 ~/.ssh/known_hosts ``` #### 步骤4:强制使用指定密钥连接 ```bash ssh -T -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 git@gitlab.com ``` --- ### 高级排查 若仍失败,创建 SSH 配置文件: ```bash nano ~/.ssh/config ``` 添加以下内容: ```config Host gitlab.com HostName gitlab.com User git IdentityFile ~/.ssh/id_ed25519 IdentitiesOnly yes AddKeysToAgent yes UseKeychain yes # MacOS 密钥链支持 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值