From owner-freebsd-questions@FreeBSD.ORG Sat Dec 27 15:10:23 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 95CA61065670 for ; Sat, 27 Dec 2008 15:10:23 +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 42D128FC08 for ; Sat, 27 Dec 2008 15:10:23 +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 F3221170A8; Sat, 27 Dec 2008 16:10:21 +0100 (CET) Received: by dominion.borderworlds.dk (Postfix, from userid 2000) id 70C1F8CB; Sat, 27 Dec 2008 16:10:21 +0100 (CET) To: freebsd-questions@freebsd.org References: <4955887F.1090704@enabled.com> From: Christian Laursen Date: Sat, 27 Dec 2008 16:10:20 +0100 In-Reply-To: <4955887F.1090704@enabled.com> (Noah's message of "Fri\, 26 Dec 2008 17\:44\:31 -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 15:10:23 -0000 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/' Reading the ssh_config man page might reveal a number of other nice features ssh has to offer. -- Christian Laursen