[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scp



On Wed, Mar 14, 2001 at 04:13:18PM +0100, Florian Steurer wrote: 

> I try to write a backup (shell-)script and use the "scp"-command. It
> asks for a password, how can I automize the passwort prompt -> I mean
> that the password is direct read from the shell script, without
> prompting. I tried something with pipes and > < , but doesn't work. I
> also tried the -B option...without any success...

Since scp uses ssh you should get comfortable with the different
authentications methods that ssh supports. You can exchange the keys
and don't have to type in your password at all.

>From $man ssh:

ssh implements the RSA authentication protocol automatically. The user
creates his/her RSA key pair by running ssh-keygen(1).  This stores the
private key in .ssh/identity and the public key in .ssh/identity.pub in
the user's home directory.  The user should then copy the identity.pub to
.ssh/authorized_keys in his/her home directory on the remote machine (the
authorized_keys file corresponds to the conventional .rhosts file, and
has one key per line, though the lines can be very long).  After this,
the user can log in without giving the password.  RSA authentication is
much more secure than rhosts authentication.

This should work with scp too.
Phil



Reply to: