SSH 접속시

SSH 접속시 "no matching key" Error 해결방법

in

SSH 접속 시 아래와 같은 에러가 발생할 때가 있습니다.

no matching key exchange method found.

Unable to negotiate with sihaku.org: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

no matching host key type found.

Unable to negotiate with sihaku.org port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

해당 에러의 발생 원인은, OpenSSH 버전 7.0 이상일때 보안상의 이유로 몇몇 키교환 알고리즘이 기본적으로 비활성화된 상태이기 때문에 발생하는 문제입니다.

Solutions

해결방법에는 두가지 방법이 존재합니다.

접속할때마다 알고리즘을 지정하는 1번 방식보다는 config 파일내 알고리즘을 세팅하는 2번 방식을 추천 합니다.

첫번째 방법: 옵션으로 알고리즘을 직접 지정합니다.

$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@host

두번째 방법: 설정 파일에 알고리즘을 추가합니다.

$ vim ~/.ssh/config

// 아래 내용을 추가 합니다.
Host [host_address]
KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms ssh-dss,ssh-rsa

내용을 추가한 이후 다음과 같이 접근 합니다.

$ ssh -c aes-128-cbc(사용할 암호 지정) username@host