Re: running shell command through ssh tunnel

On Fri, Dec 26, 2008 at 01:15:03PM -0800, Noah wrote:
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: noah@xxxxxxxxxx
ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'

ssh -t noah@xxxxxxxxxx ssh chown -R noah:noah /shares/internal/Music/

There is a difference between these two in terms of how authentication is
done. In yours, the authentication pairs are the client and;
and the client and (via the tunnel). In mine, the pairs
are the client and; and and This
makes a difference if you're using keys (not passwords): in yours, you
would have both keys on the client machine, whereas in mine, you'd
have the key for on the client machine, and the key for on

You can omit the -t if you're using keys; you need it if
prompts for a password.