Automating scp within script without passphrase

From: Mak, Andrew (Andrew.Mak@team.telstra.com)
Date: 01/15/03

  • Next message: Greg Dick: "SSH AIX 4.3.3 Problem"
    Date: Wed, 15 Jan 2003 11:49:17 +1000
    From: "Mak, Andrew" <Andrew.Mak@team.telstra.com>
    To: <secureshell@securityfocus.com>
    

    Hello ALL,

    I am curious anyone has encounter the following and how to resolve / get round it.

    I am basically setting up a scp between hosts within a script. As a result, I did the following
    1) generate an empty passphrase with the command 'ssh-keygen -t rsa -f /backup/backup-key -N "" '
    2) copy the public key to the authorized_keys file on the remote machine
    3) on the local machine, specify the scp command with the key 'scp -i /backup/backup-key /tmp/fileA remoteHost:/tmp/fileA'

    The above works as expected without any problem. However, the key basically allows anyone who has access to it to login to the remote host without any pass word / phrase. Looking up man pages on sshd, there is an option which I can specify command(s) to be run, in other words, whoever using this key is restricted to running the specified command(s) only. I tried this by specifying testing scripts on the remote host and it works. However, there seems to be a problem when specifying scp as the command. If no key is specified, it ask for the passphrase, if the key is specified, it runs into recursive calls (use in loose sense).

    Could anyone shed some light into this. Many thanks in advance

    Regards
    Andrew



    Relevant Pages