Computing.Net > Forums > Linux > scp pasword in a script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

scp pasword in a script

Reply to Message Icon

Name: francisco
Date: December 3, 2003 at 06:56:18 Pacific
OS: linux
CPU/Ram: pii 256mb
Comment:

I want to use scp to copy files from
a cron job from one linux to another linux. I notice that the scp does
not have a "batch" option. Is there a way to get scp to copy files
without asking for a password?

Many thanks,

Francisco



Sponsored Link
Ads by Google

Response Number 1
Name: 3Dave
Date: December 3, 2003 at 08:57:45 Pacific
Reply:

By using public and private keys you can ssh, scp and rcp without the need for entering passwords. "man ssh" for more info.


0

Response Number 2
Name: 3Dave
Date: December 3, 2003 at 08:59:51 Pacific
Reply:

Just had a look at the man page for scp and there is a -B switch for batch mode....


0

Response Number 3
Name: francisco
Date: December 4, 2003 at 04:10:08 Pacific
Reply:

Í just try the -B option but seems not to work. I have using openssh 3.5p1-107.



0

Response Number 4
Name: 3Dave
Date: December 4, 2003 at 06:51:38 Pacific
Reply:

I think the easiest way would be to use RSA/DSA keys stored in $ClientHome/.ssh/[ida_dsa/id_rsa] which are compared to $RemoteHome/.ssh/authorized_keys when connecting. If all is well you should just be able to pass the command:
$ scp /path/to/foobar username@hostname
which will copy the file foobar to the user's home directory on the remote server without asking for a pasword.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: scp pasword in a script

backgrounded process id in a script www.computing.net/answers/linux/backgrounded-process-id-in-a-script/28403.html

Using rsync in a script www.computing.net/answers/linux/using-rsync-in-a-script/27680.html

reading passphrase in a script www.computing.net/answers/linux/reading-passphrase-in-a-script/26748.html