From owner-freebsd-questions@FreeBSD.ORG Sat Dec 27 21:33:52 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8ABA0106567D for ; Sat, 27 Dec 2008 21:33:52 +0000 (UTC) (envelope-from admin2@enabled.com) Received: from typhoon.enabled.com (typhoon.enabled.com [216.218.220.21]) by mx1.freebsd.org (Postfix) with ESMTP id 38AF98FC13 for ; Sat, 27 Dec 2008 21:33:52 +0000 (UTC) (envelope-from admin2@enabled.com) Received: from [172.23.0.135] (nat-service4.juniper.net [66.129.225.151]) (authenticated bits=0) by typhoon.enabled.com (8.14.3/8.14.3) with ESMTP id mBRLXoAZ014574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 27 Dec 2008 13:33:51 -0800 (PST) (envelope-from admin2@enabled.com) Message-ID: <49569F39.4030209@enabled.com> Date: Sat, 27 Dec 2008 13:33:45 -0800 From: Noah User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: Matthew Seaman References: <4955887F.1090704@enabled.com> <44bpux7hjx.fsf@lowell-desk.lan> <49565C10.1010505@infracaninophile.co.uk> In-Reply-To: <49565C10.1010505@infracaninophile.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: User Questions Subject: Re: running shell command through ssh tunnel X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2008 21:33:52 -0000 Matthew Seaman wrote: > Lowell Gilbert wrote: >> Noah 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 >