Re: running shell command through ssh tunnel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:192.168.1.20:22 noah@xxxxxxxxxx
> ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/'

ssh -t noah@xxxxxxxxxx ssh 192.168.1.20 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 domain.com;
and the client and 192.168.1.20 (via the tunnel).  In mine, the pairs
are the client and domain.com; and domain.com and 192.168.1.20.  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 domain.com on the client machine, and the key for
192.168.1.20 on domain.com.

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

[Index of Archives]     [Open SSH Unix Development]     [Fedora Users]     [Fedora Desktop]     [Yosemite Backpacking]     [KDE Users]     [Gnome Users]

  Powered by Linux