Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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 http://novosial.org/openssh/publickey-auth/ which looks like a good description of this and other related details that you might find useful.

share|improve this answer
2  
+1 for key-based auth, but it's possible to script with expect, apparently: linuxforums.org/forum/linux-programming-scripting/… –  Matt Simmons Feb 26 '10 at 2:24
add comment

Your Answer

 
discard

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.