Date: Sat, 27 Dec 2008 13:33:45 -0800 From: Noah <admin2@enabled.com> To: Matthew Seaman <m.seaman@infracaninophile.co.uk> Cc: User Questions <freebsd-questions@freebsd.org> Subject: Re: running shell command through ssh tunnel Message-ID: <49569F39.4030209@enabled.com> In-Reply-To: <49565C10.1010505@infracaninophile.co.uk> References: <4955887F.1090704@enabled.com> <44bpux7hjx.fsf@lowell-desk.lan> <49565C10.1010505@infracaninophile.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Seaman wrote: > Lowell Gilbert 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/' >> >> Maybe I haven't had enough coffee yet, but wouldn't that just be >> ssh noah@192.168.1.20 'chown -R noah:noah /shares/internal/Music/' >> ? You might even want to use '-n' as an option to the ssh command. > > ENOCOFFEE. Your equivalence is only the case if you're already logged > into 'domain.com' This is a fairly standard idiom for tunnelling a network > connection in through a NAT gateway or a firewall from an external Internet > site to a protected RFC 1918 internal back-end, although the forwarded > protocol > is usually other than SSH. > > Given that the OP is wanting to tunnel SSH through SSH, a one-liner to > achieve his desired effect might be something like: > > ssh noah@domain.com ssh noah@192.168.1.20 chown -R noah:noah > /shares/internal/Music/ you will the prize. please retrieve it on the way out. :) > > Cheers, > > Matthew >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49569F39.4030209>