How To Prevent SSH From Prompting When The Host Is Unknown

If you are asked “Are you sure you want to continue connecting (yes/no)?” when trying to connect via SSH, then the remote host’s identification key has not yet been stored in your ~/.ssh/known_hosts
file.
This then requires you to type the full string “yes” in order to proceed because the default value for ssh is StrictHostKeyChecking=ask
.
To bypass this behavior (not recommended), you may add the -o StrictHostKeyChecking=no
BEFORE
1 2 3 4 5 |
myHost$ ssh demohost The authenticity of host 'demohost (10.2.2.11)' can't be established. ECDSA key fingerprint is SHA256:6KdaBv7v4+aIh1yCegIMjSFQzIqZm+LlK3Livs34OOA. Are you sure you want to continue connecting (yes/no)? <strong>yes</strong> Warning: Permanently added 'demohost' (ECDSA) to the list of known hosts. |
AFTER
1 2 |
myHost$ ssh -o StrictHostKeyChecking=no demohost Warning: Permanently added 'demohost' (ECDSA) to the list of known hosts. |
Leave Your Comment
All fields marked with "*" are required.