SSH – ssh no matching key exchange method found 원인과 해결 방법

ssh no matching key exchange method found 오류는 SSH 클라이언트와 서버가 서로 지원하는 키 교환 알고리즘(KEX)이 일치하지 않을 때 발생한다. 특히 최신 OpenSSH 클라이언트와 구형 SSH 서버 간의 연결에서 자주 발생한다.

오류 메시지 이해

$ ssh root@192.168.0.100
Unable to negotiate with 192.168.0.100 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,kex-strict-s-v00@openssh.com

클라이언트는 서버가 제시한 알고리즘 중 어느 것도 허용하지 않아서 협상(negotiation)에 실패했다는 내용이다.

원인 분석 – KexAlgorithms란?

Key Exchange Algorithms(KEX)는 SSH 연결 시 세션 키를 교환하는 데 쓰이는 암호화 방식이다.

클라이언트(예: OpenSSH 8.0+)는 다음을 지원할 수 있다.

$ ssh -Q kex
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
curve25519-sha256
curve25519-sha256@libssh.org
sntrup761x25519-sha512@openssh.com

반면 구형 서버는 다음만 지원할 수 있다.

diffie-hellman-group1-sha1

diffie-hellman-group1-sha1은 768비트짜리 고정 소수를 쓰는 구식 DH 그룹이라 Logjam류 공격에 취약하다고 알려져 있고, 이 때문에 OpenSSH는 7.0(2015년) 버전부터 기본 활성 목록에서 이 알고리즘을 제외했다.

해결 방법

일회성으로 KEX 알고리즘 강제 지정

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@192.168.0.100

호스트 키 알고리즘까지 같이 문제라면 다음처럼 둘 다 지정한다.

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa root@192.168.0.100

(Client) SSH config에 서버별 설정 추가

~/.ssh/config 파일에 다음 내용을 추가한다.

Host old-server
    HostName 192.168.0.100
    User root
    KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1

(Server) sshd_config 수정

클라이언트가 dropbear 등을 사용해 위 설정으로 대응할 수 없다면, 서버 쪽 /etc/ssh/sshd_config에 다음 설정을 추가한다.

KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
sudo systemctl restart sshd

서버 전역 설정을 낮추는 방식이라 보안상 권장되지 않으며, 신뢰된 내부망에서만 적용하는 것이 좋다.

Dropbear 환경의 추가 이슈

Dropbear는 임베디드 환경에서 많이 쓰이는 경량 SSH 서버로, 일반적인 OpenSSH보다 제한된 KEX만 제공한다.

  • 2015년 이전 Dropbear: group1만 제공
  • 2020년 이후 최신 Dropbear: group14 등 지원 추가

해결 방법

  • 클라이언트에서 KexAlgorithms를 위와 같이 허용
  • 가능하면 Dropbear 자체를 업데이트
  • 여의치 않으면 OpenSSH 서버 패키지로 교체

This Post Has One Comment

  1. Fantastic read! 👏 I really appreciate how clearly you explained the topic—your writing not only shows expertise but also makes the subject approachable for a wide audience. It’s rare to come across content that feels both insightful and practical at the same time. At explodingbrands.de we run a growing directory site in Germany that features businesses from many different categories. That’s why I truly value articles like yours, because they highlight how knowledge and visibility can create stronger connections between people, services, and opportunities.Keep up the great work—I’ll definitely be checking back for more of your insights! 🚀

답글 남기기