LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2010, 06:43 AM   #1
phyyu
LQ Newbie
 
Registered: Nov 2009
Posts: 7

Rep: Reputation: 0
Bash: auto input password how to ?


Hi guys,
When I use the scp command, here is a command prompt "Input password:",
Now I want to use a one line command to perform the scp command.
I tested the "echo "password" | scp xxx yu@10.xxx.xxx.xxx:/", but failed.
Thanks in advance.
Yu
 
Old 08-28-2010, 06:55 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
You really need to set up public key authentication so that you can use the -i <identity_file> command line switch. You could also try the -B switch but I don't think that will work unless the password is supplied at least once to begin with.

man scp
 
Old 08-28-2010, 07:01 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Both scp and ssh (both are handled by the same daemon: sshd) will not allow and do not have an options to give the password on the command line or in a script.

The only solution available is creating password-less ssh/scp.

Here are 2 articles that describes how:
Pass on Passwords with scp
HowTo SSH/SCP without a password

There are a lot more articles (and even on LQ there are many threads dealing with this). Use your search engine to look for other ones if the 2 provided aren't sufficient.

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: Input password into a variable 1veedo Linux - General 5 08-24-2010 04:07 AM
I wondering how to put the password in bash to auto login to others cpu Eatm3Pro Linux - General 2 08-18-2008 05:55 AM
User input into Bash scripts and checking validity of user input?? helptonewbie Programming 8 07-07-2008 07:40 PM
Send password input via bash script lowlifeish Linux - Software 4 02-22-2007 01:40 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 04:00 PM


All times are GMT -5. The time now is 11:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration