From owner-freebsd-questions@FreeBSD.ORG Sat Dec 27 21:45:14 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 F3E4F1065688 for ; Sat, 27 Dec 2008 21:45:13 +0000 (UTC) (envelope-from xi@borderworlds.dk) Received: from kazon.borderworlds.dk (kazon.borderworlds.dk [213.239.213.48]) by mx1.freebsd.org (Postfix) with ESMTP id B6F788FC0C for ; Sat, 27 Dec 2008 21:45:13 +0000 (UTC) (envelope-from xi@borderworlds.dk) Received: from dominion.borderworlds.dk (localhost [127.0.0.1]) by kazon.borderworlds.dk (Postfix) with ESMTP id 75FA4170A8; Sat, 27 Dec 2008 22:45:12 +0100 (CET) Received: by dominion.borderworlds.dk (Postfix, from userid 2000) id 2BA2E8CB; Sat, 27 Dec 2008 22:45:12 +0100 (CET) To: freebsd-questions@freebsd.org References: <4955887F.1090704@enabled.com> <49569EB1.9050803@enabled.com> From: Christian Laursen Date: Sat, 27 Dec 2008 22:45:11 +0100 In-Reply-To: <49569EB1.9050803@enabled.com> (Noah's message of "Sat\, 27 Dec 2008 13\:31\:29 -0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Noah Subject: Re: running shell command through ssh tunnel X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2008 21:45:14 -0000 Noah writes: > Christian Laursen 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/' >> >> 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