Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Dec 2008 22:45:11 +0100
From:      Christian Laursen <xi@borderworlds.dk>
To:        freebsd-questions@freebsd.org
Cc:        Noah <admin2@enabled.com>
Subject:   Re: running shell command through ssh tunnel
Message-ID:  <ygf1vvtb8d4.fsf@dominion.borderworlds.dk>
In-Reply-To: <49569EB1.9050803@enabled.com> (Noah's message of "Sat\, 27 Dec 2008 13\:31\:29 -0800")
References:  <4955887F.1090704@enabled.com> <ygfsko9r6w3.fsf@dominion.borderworlds.dk> <49569EB1.9050803@enabled.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Noah <admin2@enabled.com> writes:

> Christian Laursen wrote:
>> Noah <admin2@enabled.com> writes:
>>
>>> I am trying to run a shell command to the host at the far end of an ssh
>>> tunnel.   Here is how I structured access.  Is there any way to do this
>>> more compactly on one line?
>>>
>>>
>>> ssh -L 12345:192.168.1.20:22 noah@domain.com
>>> ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'
>>
>> Put something like the following in your ~/.ssh/config:
>>
>> Host otherhost
>>   HostKeyAlias otherhost
>>   ProxyCommand ssh noah@domain.com nc 192.168.1.20 22
>>
>> Then you can simply run:
>>
>> ssh otherhost 'chown -R noah:noah /shares/internal/Music/'
>
>
> I cant do this since I need to reach a publicly addressable host
> before reaching the server at 192.168.1.20

Yes, that's exactly what it does.

Try reading the mail one more time and look up how ProxyCommand
works...

-- 
Christian Laursen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ygf1vvtb8d4.fsf>