supply password to scp with out interacting

Hi,

I am trying to supply password to scp with out having manual interaction. Like, store the password in a variable and it should be supplied to the scp when it prompted for the password. Is there any other way than the user authentication and using "expect" in perl script. i.e is this possible with stty and stdin or stdout commands.

Thanks & Regards,

You can actually try Password less authentication...

1)install ssh and make sure it is running. you can use putty or telnet to test
telnet to port 22 on remote system

2)generate a key on local system ( as user required )

ssh-keygen -t rsa
      or
ssh-keygen -t dsa

Follow the on-screen instructions, but don't set a password when prompted, as you will then need to enter the password each time you want to use the key. This creates a private and a public key file.

cd to .ssh on the home directory of the user.

3)Now you just copy the contents of the public key file in .ssh/id_rsa.pub or .ssh/id_dsa.pub, and append it to the .ssh/authorized_keys file on the remote host and user you want to use when logging in. You need to append the public key file contents to each machine you want to log in to automatically.

Then you can try scp'ing like the following..

scp -pqB -i /<user>/.ssh/id_dsa_noauth ${HOST}:<source>  <local directory>

Tuxidow/others,

I am also curious to know: is there any other way to supply a password to scp apart from ssh equivalence? :confused:

Regards,

Praveen

Yes. expect, shell, lftp among others. A simple seach on the Internet will return many examples.