
업무용 PC에 연결해야 하는데 이 구성을 사용하고 있습니다.
Host work
User name
HostName 192.168.31.***
ProxyCommand ssh.exe p***@middle_host nc %h %p
middle_host
실제 데스크톱에 연결하기 전에 연결해야 하는 조직 네트워크입니다 . 성공적으로 해냈습니다 . 그러나 ssh-copy-id
비밀번호를 묻는 방법을 사용하여 ssh work
연결 하려고 하면 middle_host
회사 컴퓨터에서는 연결되지 않습니다. authorized_keys
체크인 했는데 middle_host
공개키가 거기 있어요. 그러나 비밀번호 프롬프트 없이는 여전히 연결되지 않습니다.
다양한 파일에 대한 권한 middle_host
stat -c "%a" ~
>>700
stat -c "%a" ~/.ssh/
700
stat -c "%a" ~/.ssh/authorized_keys
600
이 답변을 확인하고 답변을 따랐지만 해결할 수 없습니다.
공개 키 인증을 사용할 때 SSH 비밀번호 프롬프트가 계속 표시되는 이유는 무엇입니까?
ssh-copy-id가 성공했지만 여전히 비밀번호를 묻는 메시지가 표시됩니다.
댓글에 답장:
- middle_host(CentOs)에 루트 액세스 권한이 없어서 sshd 로그를 확인하는 방법을 모르겠습니다.
- 를 사용하여 중간 호스트에 연결을 시도합니다
ssh -v middle_host
.Unable to negotiate with ***** port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
그래서 시도해 보았는데-oKexAlgorithms=+diffie-hellman-group1-sha1
이제 출력이 다음과 같이 표시됩니다 .
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/koushik/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to ***.**.**.*** [***.**.**.***] port 22.
debug1: Connection established.
debug1: identity file /home/koushik/.ssh/id_rsa type 0
debug1: identity file /home/koushik/.ssh/id_rsa-cert type -1
debug1: identity file /home/koushik/.ssh/id_dsa type -1
debug1: identity file /home/koushik/.ssh/id_dsa-cert type -1
debug1: identity file /home/koushik/.ssh/id_ecdsa type -1
debug1: identity file /home/koushik/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/koushik/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/koushik/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/koushik/.ssh/id_ed25519 type -1
debug1: identity file /home/koushik/.ssh/id_ed25519-cert type -1
debug1: identity file /home/koushik/.ssh/id_ed25519_sk type -1
debug1: identity file /home/koushik/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/koushik/.ssh/id_xmss type -1
debug1: identity file /home/koushik/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_2*,OpenSSH_3*,OpenSSH_4* compat 0x00000002
debug1: Authenticating to ***.**.**.***:22 as '****'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group1-sha1
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:mDzOdf7c6GdlUbdzYqOPpD23W1gyyixbjxeUxHU0YlE
debug1: Host '***.**.**.***' is known and matches the RSA host key.
debug1: Found key in /home/koushik/.ssh/known_hosts:1
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /home/koushik/.ssh/id_rsa RSA SHA256:PqSSI5hAPS2zK9l+rOA7TZ01onuarhil6Fhee27+zG8
debug1: Will attempt key: /home/koushik/.ssh/id_dsa
debug1: Will attempt key: /home/koushik/.ssh/id_ecdsa
debug1: Will attempt key: /home/koushik/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/koushik/.ssh/id_ed25519
debug1: Will attempt key: /home/koushik/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/koushik/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
debug1: Next authentication method: publickey
debug1: Offering public key: /home/koushik/.ssh/id_rsa RSA SHA256:PqSSI5hAPS2zK9l+rOA7TZ01onuarhil6Fhee27+zG8
debug1: Server accepts key: /home/koushik/.ssh/id_rsa RSA SHA256:PqSSI5hAPS2zK9l+rOA7TZ01onuarhil6Fhee27+zG8
debug1: Authentication succeeded (publickey).
Authenticated to ***.**.**.*** ([***.**.**.***]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = C.UTF-8
Last login: Sun Feb 14 14:18:00 2021 from -----
답변1
먼저 SSH 구성에서 사용자를 선언했지만 ProxyCommand에서는 다른 사용자 이름을 사용했습니다.
둘째, middle_host는 이전 버전의 OpenSSH v4.3을 사용하는 반면 클라이언트는 OpenSSH v8.2p1을 사용합니다. 이전 버전의 OpenSSH는 이전 버전의 DH(Diffie Hellman) 키 교환을 사용하는데, 이는 이후 버전에서는 더 이상 지원되지 않습니다. 중간 시스템이 지원하는 세 가지 DH 매개변수 중 그룹-14가 더 좋고 그룹-1이 가장 나쁩니다. 따라서 Group-14를 지정하여 다음 명령을 실행하십시오.
ssh -v -o HostKeyAlgorithms=ssh-dss -o KexAlgorithms=diffie-hellman-group14-sha1 middle_host
참고 사항:
OpenSSH v4.3 서버를 인터넷에 노출시키는 것은 나쁜 생각입니다. VPN 사용을 고려해보세요.