Re: running shell command through ssh tunnel
Noah adm...@enabled.com 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 n...@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 n...@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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: running shell command through ssh tunnel
Noah adm...@enabled.com 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 n...@domain.com ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/' Maybe I haven't had enough coffee yet, but wouldn't that just be ssh n...@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. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: running shell command through ssh tunnel
Lowell Gilbert wrote: Noah adm...@enabled.com 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 n...@domain.com ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/' Maybe I haven't had enough coffee yet, but wouldn't that just be ssh n...@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 network connection in through a NAT gateway or a firewall from an external Internet site to a protected RFC 1918 internal back-end, although the forwarded protocol 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 n...@domain.com ssh n...@192.168.1.20 chown -R noah:noah /shares/internal/Music/ Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW signature.asc Description: OpenPGP digital signature
Re: running shell command through ssh tunnel
Christian Laursen wrote: Noah adm...@enabled.com 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 n...@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 n...@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 Reading the ssh_config man page might reveal a number of other nice features ssh has to offer. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: running shell command through ssh tunnel
Lowell Gilbert wrote: Noah adm...@enabled.com 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 n...@domain.com ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/' Maybe I haven't had enough coffee yet, but wouldn't that just be ssh n...@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. I cant do this since I need to reach a publicly addressable host before reaching the server at 192.168.1.20 . Therefore I am under the impression I need to tunnel through the publicly addressed host first then I can ssh to 192.168.1.20 . ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: running shell command through ssh tunnel
Matthew Seaman wrote: Lowell Gilbert wrote: Noah adm...@enabled.com 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 n...@domain.com ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/' Maybe I haven't had enough coffee yet, but wouldn't that just be ssh n...@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 network connection in through a NAT gateway or a firewall from an external Internet site to a protected RFC 1918 internal back-end, although the forwarded protocol 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 n...@domain.com ssh n...@192.168.1.20 chown -R noah:noah /shares/internal/Music/ you will the prize. please retrieve it on the way out. :) Cheers, Matthew ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: running shell command through ssh tunnel
Noah adm...@enabled.com writes: Christian Laursen wrote: Noah adm...@enabled.com 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 n...@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 n...@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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
running shell command through ssh tunnel
Hi there, 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 n...@domain.com ssh -p 12345 localhost 'chown -R noah:noah /shares/internal/Music/' Cheers, Noah ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org