This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| ssh [2021/07/06 04:55] – created vissie | ssh [2021/10/06 03:19] (current) – [CentOS] vissie | ||
|---|---|---|---|
| Line 232: | Line 232: | ||
| Happy days... | Happy days... | ||
| + | |||
| + | |||
| + | ====ProxyJump==== | ||
| + | The ProxyJump, or the -J flag, was introduced in ssh version 7.3. To use it, specify the bastion host to connect through after the -J flag, plus the remote host: | ||
| + | ssh -J < | ||
| + | You can also set specific usernames and ports if they differ between the hosts: | ||
| + | ssh -J user@< | ||
| + | The ssh man (or manual) page (man ssh) notes that multiple, comma-separated hostnames can be specified to jump through a series of hosts: | ||
| + | ssh -J < | ||
| + | |||
| + | ====Hard-coding proxy hosts in config==== | ||
| + | The -J flag provides flexibiltiy for easily specifying proxy and remote hosts as needed, but if a specific bastion host is regularly used to connect to a specific remote host, the ProxyJump configuration can be set in ~/ | ||
| + | <sxh bash; gutter: false> | ||
| + | ### The Bastion Host | ||
| + | Host bastion-host-nickname | ||
| + | HostName bastion-hostname | ||
| + | |||
| + | ### The Remote Host | ||
| + | Host remote-host-nickname | ||
| + | HostName remote-hostname | ||
| + | ProxyJump bastion-host-nickname | ||
| + | Using the example configuration above, when an ssh connection is made like so: | ||
| + | </ | ||
| + | ssh remote-host-nickname | ||
| =====Reverse proxy===== | =====Reverse proxy===== | ||
| Line 240: | Line 264: | ||
| Remote port 7000 will be created from localhost on port 5901 into remote server that has ssh on 1234 | Remote port 7000 will be created from localhost on port 5901 into remote server that has ssh on 1234 | ||
| + | vim ./ | ||
| + | <sxh bash; gutter: false> | ||
| + | #!/bin/bash | ||
| + | ## for kvm setups | ||
| + | #ssh -p1234 myserver.ip.add -L 5901: | ||
| + | |||
| + | # For my IP cameras https:// | ||
| + | #ssh -L 5001: | ||
| + | # For my IP cameras https:// | ||
| + | ssh -L 5000: | ||
| + | |||
| + | # For zmninja | ||
| + | #ssh -L 5000: | ||
| + | # My Router | ||
| + | #ssh -L 5000: | ||
| + | </ | ||