I have a script that will run on host1 but will make some ssh calls to host2. If host1->host2 passwordless ssh is not setup, the script will not work. How do I detect whether passwordless ssh is setup or not?
If I do something like:
`ssh host2 ls`
if [[ $? -eq 0 ]]; then
echo "Passwordless SSH works..."
else
echo "Don't have passwordless SSH"
but passwordless ssh isn't there, it hangs at the password prompt.
Basically, I want to call ssh but have the client die if the server requests a password.