SSH authentication working unless ran from script??

Posted by awright418 on Server Fault See other posts from Server Fault or by awright418
Published on 2010-04-14T20:19:44Z Indexed on 2010/04/14 20:23 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

I have set up my server to allow key/pair authentication by following instructions similar to what is found in this post.

As far as I can tell that is working correctly. If I do the following, for example, it works correctly:

ssh [email protected]

It will NOT prompt me for a password. This is what I want to happen. However if I write a small bash script like this:

#!/bin/bash -x
ssh [email protected]

and execute with:

sudo ./mytestscript.sh

...it will prompt me with:

[email protected]'s password:

What am I doing wrong? I need to be able to login from within my script without being prompted for a password!

© Server Fault or respective owner

Related posts about password

Related posts about authentication