LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-10-2011, 02:32 AM   #1
lothario
Member
 
Registered: Apr 2004
Posts: 340

Rep: Reputation: 30
ssh me@host1 'ssh me@host2'


If I want to execute the "who" command on the host "monkey" then I can simply do this.
Code:
ssh  bob@monkey  'who'
bob@monkey's password: 
bob      pts/0        2011-09-09 21:24 (gorilla)
bob      tty7         2011-08-14 01:15 (:0)
But if I try ssh on to the host "donkey" via the host "monkey" it does not work.
Code:
ssh  bob@monkey  'ssh  bob@donkey'
bob@monkey's password: 
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
Can this be done?

My passwords on monkey and donkey are different.
It did not even ask me to enter my password for the host "donkey".
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-10-2011, 02:34 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Can I ask why you would want to do this?

Cheers,

Josh
 
Old 09-10-2011, 02:55 AM   #3
lothario
Member
 
Registered: Apr 2004
Posts: 340

Original Poster
Rep: Reputation: 30
Once I am logged on monkey, from there I frequently need to logon to several other hosts like donkey.
So
ssh + password + password + exit
can be faster than
ssh + password + ssh + password + exit + exit
besides, the actual hostnames and options are quite long so a simple script called donkey
donkey + password + password + exit
would be efficient and faster, for me.
 
Old 09-10-2011, 03:06 AM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Maybe you could write a script that would pass the passwords to the ssh commands, and use arguments for whatever commands that you need to be ran?
 
Old 09-10-2011, 03:15 AM   #5
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,

I do believe that the lack of a (pseudo)terminal is the reason why the initial command doesn't work. Give this a try:
Code:
ssh -t bob@monkey 'ssh bob@donkey'
the -t option forces a (pseudo)terminal.

Hope this helps.
 
2 members found this post helpful.
Old 09-10-2011, 03:27 AM   #6
lothario
Member
 
Registered: Apr 2004
Posts: 340

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by druuna View Post
Hi,

I do believe that the lack of a (pseudo)terminal is the reason why the initial command doesn't work. Give this a try:
Code:
ssh -t bob@monkey 'ssh bob@donkey'
the -t option forces a (pseudo)terminal.

Hope this helps.
That was perfect!
Thank you.
 
Old 09-10-2011, 03:28 AM   #7
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
You're welcome
 
Old 09-10-2011, 06:01 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Ahh, I forgot about that. Thanks for that.... I haven't used linux in a bit because my laptop died....
 
  


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
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
setting up an ssh soxy or local ssh tunnel from within an ssh soxy Mangenius Linux - Networking 0 03-05-2007 03:15 PM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM
host1 to host2 connection only shows login users. btexpress Linux - Networking 0 06-01-2004 12:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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