LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 08-04-2010, 01:12 AM   #1
info1686
LQ Newbie
 
Registered: Jan 2009
Posts: 15

Rep: Reputation: 0
Passing SSH a password through command line


Hello,

I am writing a script to get hardware information of a particular UNIX machine. To do this, I ftp a shell script (commands to get h/w information) to the target machine and then use SSH to remote the remote script.

With FTP, I can pass a password accepted as input the shell script. How can I pass the same password to SSH ? This is because I do not want the user to enter the password twice.

I am not worried about the password security.

Thanks
 
Old 08-04-2010, 01:28 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hello,

Have a look at this thread.

Kind regards,

Eric
 
Old 08-04-2010, 01:29 AM   #3
A.Thyssen
Member
 
Registered: May 2006
Location: Brisbane, Australia
Posts: 119

Rep: Reputation: 32
ssh has methods to allow you to log into a machine from a specific account without a password.

See http://www.cit.griffith.edu.au/~anth.../ssh_howto.txt


Their are also wrapper programs (like expect) that will wrap the command in a fake TTY so that you can again pipe a password into the command, while the command thinks it is getting it from a users TTY.

See...
http://www.cit.griffith.edu.au/~anth...eractive.hints

Where I wrote down tips and solutions to controlling interactive programs.
 
Old 08-04-2010, 01:31 AM   #4
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
One common way to use "ssh" without requiring a password on the command line is to use a pair of authentication keys. Here are two links describing this:

http://linuxproblem.org/art_9.html

http://www.debian-administration.org...ad_of_password

'Hope that helps .. PSM
 
Old 08-05-2010, 01:02 AM   #5
info1686
LQ Newbie
 
Registered: Jan 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Hi All,

Thanks for the replies. I can aware of ssh-keygen but I do not want to use that since there are several 100 machines I want to connect to and dont want to do this for all machines.

I tried expect but I get an error command not found

Thanks
 
Old 08-05-2010, 01:17 AM   #6
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Quote:
Originally Posted by info1686 View Post
Hi All,

Thanks for the replies. I can aware of ssh-keygen but I do not want to use that since there are several 100 machines I want to connect to and dont want to do this for all machines.

I tried expect but I get an error command not found

Thanks
Hi,

Have you read the thread I linked to in post #2? Have a look at sshpass.

Kind regards,

Eric
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing command-line arguments to qglviewer application MALDATA Programming 1 07-15-2009 10:27 AM
Passing directory name as a command line argument adilwaheed Linux - Newbie 4 03-12-2009 04:01 PM
passing command line to a BASH function GSMD Programming 16 04-21-2007 04:23 AM
Passing a text file to the command line as arguments wimnat Linux - General 2 12-05-2005 09:09 AM
Can you specift password on SSH command line? The_JinJ Linux - Newbie 4 07-26-2005 06:55 AM


All times are GMT -5. The time now is 02:13 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration