LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 05: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, 05:55 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
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, 06:01 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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



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 03:07 AM
I wondering how to put the password in bash to auto login to others cpu Eatm3Pro Linux - General 2 08-18-2008 04:55 AM
User input into Bash scripts and checking validity of user input?? helptonewbie Programming 8 07-07-2008 06:40 PM
Send password input via bash script lowlifeish Linux - Software 4 02-22-2007 12:40 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:14 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
Open Source Consulting | Domain Registration