리셋 되지 말자

ssh 접속 ECDSA key fingerprint 자동 등록 본문

Linux Tips

ssh 접속 ECDSA key fingerprint 자동 등록

kyeongjun-dev 2021. 5. 27. 16:46

문제

ssh로 처음 접속을 할 때, 아래와 같이 신뢰할 수 있냐 마냐를 물어본다.

ssh vagrant@192.168.56.201
The authenticity of host '192.168.56.201 (192.168.56.201)' can't be established.
ECDSA key fingerprint is SHA256:MhZLkVZMcsNgbx8bxcXy+fBeEjecMgKgx7HhmRwpfrQ.
Are you sure you want to continue connecting (yes/no)?

 

해결

ssh-keyscan 커맨드를 통해 자동으로 known_hosts에 등록할 수 있다.

- example

$ cat known_hosts 

$ ssh-keyscan -t rsa 192.168.56.201 >> known_hosts 
# 192.168.56.201:22 SSH-2.0-OpenSSH_7.4

$ ls
known_hosts

$ cat known_hosts 
192.168.56.201 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAB9VsA2gRleeoR0cD0u5efu0LrUyEJxbITNDTjxtnVx0db+80vsbcnUcSILe2rojiE++3lG3NYghTQ/7rm6nF0mP2WVsEshwP6jeuRM47U0UQRQM+2E2DmliDUGTPs3OO1Qxl2yvzf3xWt9OhQgjgiH1xGiqysrA5kLHhsIKk9KNeRqmd37R4VrLPerbMTq5/aGVeyhzbvzYx/PgjNwxDB0qPOR2hBWi/cwX0oxaHAi+PCw/1fTYD7j7PreCS+rM/4gFifbXNGU7KD/b61zrDTKYDXZEDJrydB90ut9XlsVUSHlZbo3jhsMl06UiEZ0eYa3tzv9Iu6ZKkSWA6FkSH

 

Comments