Bash script to check ssh passwordless connection is established or not?

Posted: October 27, 2017 in Verify Password less SSH connection

#!/bin/bash
echo “Script to verify password less between Linux Server”
echo “Enter Remote_username :”
read user

echo “Enter Remote_Server_IP :”
read ip

/usr/bin/ssh -o PasswordAuthentication=no $user@$ip /bin/true
if [ $? -eq 0 ]; then
echo Already passwordless connection between two systems
exit 1
else
echo SSH passwordless connection is not yet enabled between two system
fi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s