Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ssh help needed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Tue Feb 12, 2013 1:15 pm    Post subject: ssh help needed Reply with quote

I'm doing:

Code:
ssh -a -l notroot host1.domain.com ssh -l root host2.domain.com 'cmd1 ; cmd2 ; cmd3 ; cmd4'


I'm expecting cmd1-4 to run on host2 and it does for ssh (client) version: OpenSSH_4.3p2 OpenSSL 0.9.8c 05 Sep 2006 but not for

ssh (client) version : OpenSSH_5.3p1 OpenSSL 0.9.8k 25 Mar 2009

What happens is, the single-quote is removed by the newer version of ssh client, which results in cmd1 being executed on host2, while the rest are executed on host1.

In the version of ssh client that works, the complete command with quotes is transfered, so all commands are executed on host2.

Is there a config that can get me the desired behaviour?
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1569
Location: U.S.A.

PostPosted: Tue Feb 12, 2013 3:21 pm    Post subject: Reply with quote

I don't know. I would try:
Code:
ssh -a -l notroot host1.domain.com "ssh -l root host2.domain.com 'cmd1 ; cmd2 ; cmd3 ; cmd4'"

Or try:
Code:
ssh -a -l notroot host1.domain.com ssh -l root host2.domain.com \'cmd1 ; cmd2 ; cmd3 ; cmd4\'

Or try:
Code:
ssh -a -l notroot host1.domain.com <<\EOF
ssh -l root host2.domain.com 'cmd1 ; cmd2 ; cmd3 ; cmd4'
EOF


Also, possibly try using the -t option in the first connection.

And all the various combinations thereof. :)
_________________
Naib wrote:
you need a dick sometimes to deal with the assholes


Last edited by Bones McCracker on Tue Feb 12, 2013 3:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Tue Feb 12, 2013 3:26 pm    Post subject: Reply with quote

I have tried the last two and the -t, I haven't tried the first one. I'll try that out.

Thanks.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
MustrumR
n00b
n00b


Joined: 15 Nov 2011
Posts: 55
Location: Right here

PostPosted: Tue Feb 12, 2013 5:32 pm    Post subject: Reply with quote

You can almost always open an ssh tunnel and use it.
Code:
ssh -a -l notroot host1.domain.com -L12345:host2.domain.com:22 -T &
ssh -a -p 12345 -l root 127.0.0.1 -t "cmd1 ; cmd2 ; cmd3 ; cmd4"


The first command opens a tunnel - localhost:12345 through host1.domain.com to host2.domain.com:22
The second one connects through that tunnel and executes the commands.
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 120
Location: Bangalore, India

PostPosted: Tue Feb 12, 2013 6:38 pm    Post subject: Reply with quote

Thanks.
_________________
The problem is not the problem. The problem is your attitude about the problem. Do you understand? --Capt Jack Sparrow.
Back to top
View user's profile Send private message
szczerb
Veteran
Veteran


Joined: 24 Feb 2007
Posts: 1646
Location: Poland => Lodz

PostPosted: Tue Feb 12, 2013 8:09 pm    Post subject: Reply with quote

I onced found a need to pipe over two ssh connections. As I understand your case is a bit simpler, so take a look at that.
Code:
cat something.tar.gz | ssh user@host1 "ssh user@host2 'tar -xzf - -C /some/path/; chown -R user:group /some/path'"


The thing is that passwordless login was set between host1 and host2.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum