Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Dec 2008 16:47:12 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        User Questions <freebsd-questions@freebsd.org>
Cc:        Noah <admin2@enabled.com>
Subject:   Re: running shell command through ssh tunnel
Message-ID:  <49565C10.1010505@infracaninophile.co.uk>
In-Reply-To: <44bpux7hjx.fsf@lowell-desk.lan>
References:  <4955887F.1090704@enabled.com> <44bpux7hjx.fsf@lowell-desk.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig23F7755DC2D7A4C709656272
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Lowell Gilbert wrote:
> Noah <admin2@enabled.com> writes:
>=20
>> I am trying to run a shell command to the host at the far end of an ss=
h
>> tunnel.   Here is how I structured access.  Is there any way to do thi=
s
>> 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/'
>=20
> 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 netwo=
rk
connection in through a NAT gateway or a firewall from an external Intern=
et
site to a protected RFC 1918 internal back-end, although the forwarded pr=
otocol
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/inte=
rnal/Music/

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW


--------------enig23F7755DC2D7A4C709656272
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAklWXBYACgkQ8Mjk52CukIwL2gCdEpgl05qGEY8pgPyjxxf9wh/i
eLcAn1nTHzqXP631xSigoF4RVarKE8pQ
=2p8o
-----END PGP SIGNATURE-----

--------------enig23F7755DC2D7A4C709656272--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49565C10.1010505>