
나는 약 한 달 동안 Mac을 통해 원격 서버에 연결해 왔습니다. 그런데 최근에 ssh dylan@MY_IP를 사용하여 연결을 시도했는데 이 메시지를 받았습니다.
ssh_exchange_identification: read: Connection reset by peer
진단정보도 얻었는데..
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to {MY IP{ [MY IP] port 22.
debug1: Connection established.
debug1: identity file /Users/watson/.ssh/id_rsa type -1
debug1: identity file /Users/watson/.ssh/id_rsa-cert type -1
debug3: Incorrect RSA1 identifier
debug3: Could not load "/Users/watson/.ssh/id_dsa" as a RSA1 public key
debug1: identity file /Users/watson/.ssh/id_dsa type 2
debug1: identity file /Users/watson/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
몇 가지 조사를 한 후 다음을 시도했습니다 ...
- 라우터를 다시 시작했습니다.
- 내 "known_hosts" 파일을 지웠습니다.
- 내 "known_hosts" 파일을 삭제했습니다.
- 내 DHCP 출시 및 갱신
- 또한 오류가 있는 Putty를 사용하여 다른 장치(Windows)에서도 시도했습니다.
이 통신을 금지하기 위해 서버를 변경하지 않았습니다.
또한 이것이 문제를 일으킬지는 모르겠지만 IP뿐만 아니라 도메인 이름으로 연결했습니다.
또한 다른 IP 주소에서도 성공적으로 연결할 수 있었습니다.
나는 이것이 많은 리소스로 인해 큰 문제라는 것을 알고 있지만 많은 솔루션이 작동하지 않았으며 누군가를 위한 어떤 유형의 해결 방법도 실제로 보지 못했습니다.
업데이트
프로토콜 1로 강제 적용했습니다. "피어에 의한 연결 재설정" 대신 "원격 호스트에 의해 연결이 닫혔습니다"라는 메시지가 표시됩니다. 디버그 정보가 표시된 상태에서 실행하면 다음과 같습니다.
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to MY_IP [MY_IP] port 22.
debug1: Connection established.
debug1: identity file /Users/watson/.ssh/identity type -1
debug1: identity file /Users/watson/.ssh/identity-cert type -1
ssh_exchange_identification: Connection closed by remote host
답변1
SSH 서버에 연결할 때 "ssh_exchange_identification: 원격 호스트에 의해 연결이 닫혔습니다." 오류를 해결한 방법입니다.
루트에 패키지 압축을 푼 후 임베디드 Linux 시스템에 연결하려고 할 때 이 오류가 발생했습니다. libssl을 포함하여 많은 라이브러리 파일이 교체되었습니다.
연결을 시도하는 중:
chetic@ubuntu:~$ ssh -v [email protected]
OpenSSH_6.2p2 Ubuntu-6ubuntu0.3, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to SC [192.168.1.100] port 22.
debug1: Connection established.
debug1: identity file /home/delaval/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/delaval/.ssh/id_rsa-cert type -1
debug1: identity file /home/delaval/.ssh/id_dsa type -1
debug1: identity file /home/delaval/.ssh/id_dsa-cert type -1
debug1: identity file /home/delaval/.ssh/id_ecdsa type -1
debug1: identity file /home/delaval/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.3
ssh_exchange_identification: read: Connection reset by peer
인터넷 검색에서는 호스트.거부 및 호스트.허용 확인만 제안하는 것 같았지만 내 대상 컴퓨터에는 그러한 파일이 없었습니다.
재부팅 후 (Karthik의 제안에 따라) sshd가 실행되지 않았습니다. 대상에서 sshd를 수동으로 시작하려고 시도했습니다.
# sshd
OpenSSL version mismatch. Built against 1000002f, you have 1000105f
/usr/lib/libssl.a를 원래 버전으로 바꾸고 sshd를 시작했는데 모든 것이 정상으로 돌아왔습니다. 내 경우에는 원래 루트에 압축을 푼 패키지의 잘못된 버전으로 인해 문제가 발생했습니다.
답변2
나는 같은 오류를 겪고 있었습니다(그러나 를 통한 문제가 있는 기계를 포함한 모든 기계에서 ssh localhost
).
사용자 프로필을 마이그레이션할 때 시작되었습니다. 즉, 루트로 파일을 복사한 후 다음과 같은 명령을 수행했습니다.chown -R username /Users/username/Destop
어쨌든 /var/empty owner가 사용자 이름으로 변경된 이유는 확실하지 않지만 ssh
확실히 /var/empty
루트가 소유해야 합니다(그렇지 않으면 ssh_exchange_identification: read: Connection reset by peer
).
sudo chown root /var/empty
답변3
이는 로컬 컴퓨터의 문제가 아니라 서버 측의 문제입니다. 있을 수있다여러 요인이 문제의 원인:
- 원격 서버의 /etc/hosts.allow 또는 /etc/hosts.deny 구성이 변경되었습니다.
- 서버 부하가 심함.
과거에 이러한 문제가 발생했을 때 나는 다음 두 가지 작업 중 하나를 다음 순서로 수행했습니다.
- 위 문서에서 참조한 대로 /etc/hosts.allow를 수정합니다. (그리고 SSH 서버를 다시 시작하세요)
- /etc/hosts.allow가 이미 필요한 방식인 경우 SSH 서버를 다시 시작하세요. (이 작업을 수행할 때는 주의하세요!)
- 다시 시작해도 작동하지 않으면 서버 키를 다시 생성하고 SSH 서버를 다시 시작합니다(이 시스템에 로그인하는 모든 사용자는 서버의 키가 변경되었다는 오류를 받게 되므로 위험합니다).
대개 1번으로 문제가 해결되지만 어떤 경우에는 2번을 해야 하기도 했습니다.. 알 수 없었습니다.왜그것은 단지 그것이 효과가 있었다는 것뿐입니다. 아마도 키가 표시되는 방식과 관련이 있거나 어떤 식으로든 손상되었을 수도 있습니다. 확실하지 않습니다. 그러나 내가 아는 것은 오류가 전적으로 서버와 관련된 것이며 SSH 연결이 설정될 때 핸드셰이크가 발생하는 방식이라는 것입니다.
답변4
그것은 확실히 버그입니다. ssh는 내 컴퓨터 중 하나에서는 작동하지만 다른 컴퓨터에서는 작동하지 않습니다. 해결했습니다. 다음을 따르세요.
- 만료일이 없는 액세스 토큰을 생성하고 사용 가능한 모든 옵션을 선택하세요.
- 기존 SSH 키를 제거합니다.
- SSH 대신 https를 사용하여 저장소를 복제합니다.
- 사용자 이름을 사용하되 비밀번호 대신 생성된 액세스 토큰을 사용하세요.
또는 기존 저장소에서 이 명령을 사용하여 원격을 http로 설정하고 이 명령을 사용할 수 있습니다 git remote set-url Originhttps://gitlab.com/[사용자 이름]/[repo-name].git