증상
애플 macOS High Sierra 버전으로 업그레이드 후, 아래와 같은 에러가 나며 네트워크 스위치나 방화벽을 접속할 수 없다.
Unable to negotiate with 192.168.1.1 port 22: no matching host key type found. Their offer: ssh-dss
Unable to negotiate with 192.168.1.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
해결
방법1 (반 영구적 방법)
Vi와 같은 텍스트 에디터를 이용해 /etc/ssh 디렉토리에 있는 ssh_config 파일을 연다.
sudo vi /etc/ssh/ssh_config
아래와 같이 라인을 찾아 맨 앞에 있는
# (주석)
을 제거한다.
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
그리고 맨 아래에 아래와 같은 라인을 추가한다.
HostkeyAlgorithms ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1
저장하고 나간다. (
ESC
누르고)
:wq!
방법2 (일회용 방법)
접속할 때 옵션을 추가한다.
-o HostKeyAlgorithms=+ssh-rsa
-o PubkeyAcceptedAlgorithms=+ssh-rsa
ssh myname@mysite.kr -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa