running shell command through ssh tunnel

Christian Laursen xi at borderworlds.dk
Sat Dec 27 21:45:14 UTC 2008


Noah <admin2 at enabled.com> writes:

> Christian Laursen wrote:
>> Noah <admin2 at 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 at 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 at 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


More information about the freebsd-questions mailing list