4

how can i pass the password along with the scp command.when we use the scp protocol, it prompts us for the password.But i want to pass it as a parameter.Is that possible without using the key generation techniques?

rushi
  • 495
  • 3
  • 7
  • 16

3 Answers3

3

What you want to achieve is not possible without using keys, or heavy duty scripting of the terminal.

Why don't you want to use keys? It's the easiest most secure solution to your problem.

Also take a look at: How to make ssh receive the password from stdin

Many scripting languages have modules that let you interact with ssh. If you're familiar with Perl you could take a look at the Net::SSH family of modules at CPAN: http://metacpan.org/pod/Net::SSH2

Community
  • 1
  • 1
thomasmalt
  • 1,692
  • 11
  • 15
  • @rushi When an answer is useful, upvote it. If it answers your question, mark it the official answer of this question by clicking the star. – mattalxndr Mar 11 '11 at 20:34
1

you have to use public/private key authentication. on ubuntu this works like described here: https://help.ubuntu.com/community/SSH/OpenSSH/Keys

note: other -nix flavors should work in a similar.

udo
  • 3,632
  • 4
  • 43
  • 62
  • yeah but i don't want to use ssh keys.In my script i have to pass the password as the argument to the scp command.is that possible?? – rushi Oct 06 '10 at 12:11
  • But will work if i ll pass on a file containing the password?? – rushi Oct 06 '10 at 12:14
  • What scripting language are you planning on using? – thomasmalt Oct 06 '10 at 12:16
  • with scp you can't pass the password, unfortunately... maybe there is a workaround using the [-o ssh_option] option of scp http://manpages.ubuntu.com/manpages/lucid/en/man1/scp.1.html – udo Oct 06 '10 at 12:19
  • i am using the python script.. – rushi Oct 06 '10 at 12:22
-3

Can you check if this works -

<username>:<password>@<host>
Sachin Shanbhag
  • 50,935
  • 9
  • 84
  • 103