2

First, I'm sorry if this post duplicate another one. But if it does, I did not find it through my research :)

The problem is :

I need to check if I can connect to a server via ssh without using a password. I know you need to make a key to do so, but I just want to check if it was well done in bash.

I found a lot of things about how to test availability of the server, etc ... but not what I was searching for.

Thanks in advance for your answer ;)

T.F.

1 Answer 1

4

I found a solution after a new try ^^ (yeah, short time between post and solution ;) )

echo -e "Checking if you have setup a key for serve ssh connection ..."
ssh -o BatchMode=yes uname@host 'exit'
if [ $? -eq 0 ]
then
  echo -e "You're done"
else
  echo -e "Set up a ssh key please "
fi
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.