Results 1 to 3 of 3
Hey everyone, I have a short little bash script that uses scp (secure copy, uses ssh) to copy a folder from one box to another. Now to avoid scripting my ...
- 09-04-2009 #1Just Joined!
- Join Date
- Dec 2007
- Posts
- 27
[SOLVED] Scripting ssh, without password prompt???
Hey everyone, I have a short little bash script that uses scp (secure copy, uses ssh) to copy a folder from one box to another. Now to avoid scripting my ssh password I put the public key on my remote server and the private key on my local box.
i use the scp switch -i which allows for an identity file
This is fairly straight forward and eliminated the problem of scripting my password in plain text.Code:scp -i /home/myuser/.ssh/id_rsa /tmp/$1.tar.gz $user@$server:$dir
HOWEVER, the script prompts me for the password to the key (id_rsa) file :
Now in Ubuntu it allowed me to unlock this key for the root user at login, so I was able to make the script a cron job to run without user interaction(the goal). I now use Debian and do not know how to avoid the prompting for the key password. I would like to make this a cron job, so user interaction isn't viable.Code:Enter passphrase for key '/home/myuser/.ssh/id_rsa':
the id_rsa file has permissions 700 and is owned by user root and group root.
I have the whole script, just can't get past the password prompt lol...
thanks everyone, any help is really appreciated!!!
- 09-04-2009 #2
Forget passwords and use keys for automated processes. It is safer also.
- 09-04-2009 #3Just Joined!
- Join Date
- Dec 2007
- Posts
- 27
thanks for the response. i am using keys though, its whenever i use the keys via ssh or scp the key asks for a password. now i set one at the time of creating it, is that not the way to do it?
edit :
okay, i just made a new key without the password and that's the fix... thanks for the help. much appreciated.



