Find the answer to your Linux question:
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 ...
  1. #1
    Just 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
    Code:
    scp -i /home/myuser/.ssh/id_rsa /tmp/$1.tar.gz $user@$server:$dir
    This is fairly straight forward and eliminated the problem of scripting my password in plain text.
    HOWEVER, the script prompts me for the password to the key (id_rsa) file :
    Code:
    Enter passphrase for key '/home/myuser/.ssh/id_rsa':
    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.

    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!!!

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    Forget passwords and use keys for automated processes. It is safer also.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Posts
    27
    Quote Originally Posted by Lazydog View Post
    Forget passwords and use keys for automated processes. It is safer also.
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...