Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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* ~/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.

share|improve this question
up vote 5 down vote accepted

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 which looks like a good description of this and other related details that you might find useful.

share|improve this answer
+1 for key-based auth, but it's possible to script with expect, apparently:… – Matt Simmons Feb 26 '10 at 2:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.