Hello Unix scripters,
I have created a small tool that i can distribute to users to check whether they have passwordless login to a list of servers.
The problem in my code below is if user do not have the passwordless login yet, it will prompt them with a password login and my message below will never be displayed. Users then will either enter their password or just control-c which i dont want
Am i tackling the right logic and code here?
echo "Logging in as \"${SERVERS_ID}\" to $SERVER"
ssh ${SERVERS_ID}@${SERVER} "exit"
if [ "$?" -ne 0 ] ; then
echo "Couldn't connect to server, please verify whether server is up or your ssh passwordless login to \"${SERVERS_ID}\" is setup properly."
else
echo "CONNECTED"
fi