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 03-29-2006, 06:32 AM   #1
Thomas Ene
LQ Newbie
 
Registered: Mar 2006
Posts: 1

Rep: Reputation: 0
Input redirecting


Hi.
I am trying to do a script that will be able to read the input from a file or the output of a script (best).

For example: if I want to specify a password to a scp command
I have done a first script simmilar to this:

sleep_pass
---------------
sleep 3
echo "password"

and piped this script script to the scp:
./sleep_pass | scp a.txt user@host:/path/
( the sleep 3 command was for waiting the scp to get a password prompt
I am not sure however that this is the way to do it )

unfortunatley it's not working.
Another idea that I had was to writing to the tty: something like:
echo "pass" > /dev/pts/5... (but is not working either)

Do you have any ideas about this?
Can this be done... ( I am sure it can be done.. I am not sure that it's just as simple)

Thank you very much
 
Old 03-29-2006, 07:59 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
you've not really described how you want this entire solution to work, but i would guess you'd want to look towards expect for this. expect is specifically designed for automating interaction with remote devices and other application requiring user responses. you can also use the autoexpect program to basically watch what you do and remember how to do it again.
 
Old 03-29-2006, 09:28 PM   #3
Jeiku
Member
 
Registered: Jul 2005
Posts: 64

Rep: Reputation: 18
you can't do this. If you want it to work like that you will need to setup ~/.ssh/authorized_hosts and add the keyfile of the user connecting to that file. You can then specify the private file to scp and it will not ask for a password.
 
Old 03-29-2006, 09:30 PM   #4
Jeiku
Member
 
Registered: Jul 2005
Posts: 64

Rep: Reputation: 18
PS.
Sorry that was not very clear, see:
http://www.puddingonline.com/~dave/p...s-HOWTO-4.html

http://www.eos.ncsu.edu/remoteaccess/man/scp.html

you can then specify the -i option to scp
 
Old 03-30-2006, 12:16 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
to the question you actually asked the answer is "expect". to the question you should have asked if the task is solely to automate static scp commands, the answer is shared keys under ssh. There would be no need to use specific -i flags if your generic ssh security is configured to allow rsa / dsa access. there's a good article in our wiki about how to configure this.
 
  


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
Automating tasks by redirecting input lsgko Linux - Software 4 02-26-2006 11:47 PM
Ctrl+Shift Unicode input gone, after installing Japanese Input Methodes polemon Linux - Newbie 1 09-20-2005 05:17 PM
Sendmail: timeout waiting for input from local during Draining Input andrewstr Linux - Software 0 07-14-2004 01:43 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 03:00 PM
Redirecting Half_Elf Linux - Networking 2 09-04-2002 10:51 PM

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

All times are GMT -5. The time now is 01:57 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