2

I have asked a question before in here. My question was that I tried to give my password to scp via piping

echo mypassword | scp tim@xxx.xxx.xxx.xxx:project/* ~/project/  

However it still asks me to manually input the password. How should I specify mypassword to scp in commands?

I still don't understand one of the replies. what is a input stream by TTY, for example? What are the common ways for a input stream? How to know what type of input stream a stdin input to a command is? For example that of ssh/scp.

Tim
  • 1,467
  • 3
  • 25
  • 38

1 Answers1

5

Basically SSH (and related tools like SCP and SFTP) probes where its input seems to be coming from, and if it isn't from what could be an actual user it won't accept passwords through that method and will instead ask for a password or passphrase from the user more directly.

For security reasons it is inadvisable (and, IIRC, actually impossible) to provide your SSH password on the command line as you are desiring to do.

If you need to login without password you need to configure key based authentication, which thankfully isn't difficult. There are many good tutorials out there, a quick search pulled up http://novosial.org/openssh/publickey-auth/ which looks like a good description of this and other related details that you might find useful.

user1204270
  • 183
  • 1
  • 7
David Spillett
  • 22,534
  • 42
  • 66
  • 2
    +1 for key-based auth, but it's possible to script with expect, apparently: http://www.linuxforums.org/forum/linux-programming-scripting/24126-ssh-username-password-script.html#post574932 – Matt Simmons Feb 26 '10 at 02:24