Public bug reported: On xenial, ssh-keyscan returns zero indicating success, when the command fails.
root@cp1:~# lsb_release -d Description: Ubuntu 16.04.1 LTS root@cp1:~# ssh-keyscan -H -t ssh-rsa bad-host getaddrinfo bad-host: Name or service not known root@cp1:~# echo $? 0 On trusty, the exit status is non-zero as expected. root@integration-deployer:/home/ubuntu# lsb_release -d Description: Ubuntu 14.04.5 LTS root@integration-deployer:/home/ubuntu# ssh-keyscan -H -t ssh-rsa bad-host getaddrinfo bad-host: Name or service not known root@integration-deployer:/home/ubuntu# echo $? 255 This is a incompatibility between Ubuntu 14.04 and 16.04 ** Affects: openssh (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1661745 Title: ssh-keyscan does not exit with non-zero return code on error To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1661745/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs