Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-02-2007, 05:32 PM   #1
Registered: Nov 2004
Posts: 63

Rep: Reputation: 15
Question specifying password in the ssh command

in windows using plink i can execute the following command

plink.exe -ssh -l root -pw password9 /sbin/shutdown -r ,to reboot a remote linux box.

not i want to execute the above command in linux ?
Is there a way in from linux i can specify password in the command line.

for example i checked the man page it does have an option for -l (login) but it does't have an option for specifying the password.

The man page only says you have to go through the keygen process ,so that next time it doesnt asks you the password.

Anybody is aware how to reboot a remote Linux machine from another linux box (without installing any extra package)?

Last edited by alix123; 06-02-2007 at 05:42 PM.
Old 06-02-2007, 05:53 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
The keygen program isn't a new package. It is a part of the ssh installation. Even in windows, putty for example would have a similar program installed. You can also use expect.

However, you are doing two very bad things.
1) putting the password in a script is a very bad thing to do. If the windows machine is compromised, every machine who's password you have stored is also compromised.
2) Your target linux machine allows root logins.

Even using keygen and authorized hosts isn't the best thing to do, because if your windows machine is compromised, so are the keys. It is best to set up the keys to require a passphrase and then use ssh-agent when you boot the machine. Then you enter the passphrase (from memory) once then can then run automated scripts which supply the keys needed to connect to the remote server.

Last edited by jschiwal; 06-02-2007 at 05:54 PM.
Old 06-03-2007, 04:00 AM   #3
Registered: Nov 2004
Posts: 63

Original Poster
Rep: Reputation: 15
Question I'am not concerned about the security of the machine


I'am not concerned about the security of the machine,since all of the machines are test machines and have private addressing scheme. and we reimage the machines very often.

I'am more concerned about executing command remotely to reboot the machine.

Are you aware of a way to do it ?? so that i can put that in my scripts? objective here is

Linux Scripts machine ----Reboot---> Remote Linux machine

Last edited by alix123; 06-03-2007 at 04:03 AM.


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
ssh with password adnanm Linux - Newbie 6 03-25-2011 11:08 AM
need help with no password ssh and ssh-agent hedpe Linux - Networking 3 02-08-2007 08:49 PM
Can you specift password on SSH command line? The_JinJ Linux - Newbie 4 07-26-2005 05:55 AM
Pass password with ssh command BruceC Linux - Newbie 2 05-12-2004 08:55 AM
remote command over ssh, password prompt linowes Linux - General 2 10-27-2002 08:22 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:36 AM.

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