-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from cedadev/proxyjump_wildcard
add wildcard example for proxyjump - also change user in command prompt in other examples
- Loading branch information
Showing
1 changed file
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,11 +78,11 @@ The connection via a login server can be done either with 2 hops, or using a log | |
{{<command user="user" host="localhost">}} | ||
ssh -A [email protected] | ||
{{</command>}} | ||
{{<command user="user" host="login-01">}} | ||
{{<command user="fred" host="login-01">}} | ||
ssh [email protected] | ||
## no -A needed for this step, if no onward connections from sci server | ||
{{</command>}} | ||
{{<command user="user" host="sci-vm-01">}} | ||
{{<command user="fred" host="sci-vm-01">}} | ||
## now on sci server | ||
{{</command>}} | ||
|
||
|
@@ -91,7 +91,7 @@ ssh [email protected] | |
{{<command user="user" host="localhost">}} | ||
ssh -A [email protected] -J [email protected] | ||
{{</command>}} | ||
{{<command user="user" host="sci-vm-01">}} | ||
{{<command user="fred" host="sci-vm-01">}} | ||
## now on sci server | ||
{{</command>}} | ||
|
||
|
@@ -110,10 +110,37 @@ You could then simply connect to `Sci1ViaLogin01`: | |
{{<command user="user" host="localhost">}} | ||
ssh Sci1ViaLogin01 | ||
{{</command>}} | ||
{{<command user="user" host="sci-vm-01">}} | ||
{{<command user="fred" host="sci-vm-01">}} | ||
## now on sci server | ||
{{</command>}} | ||
|
||
If you don't want to have to set up a separate alias for each machine that you want to log into, you can also set up a wildcard, for example: | ||
|
||
```config | ||
Host *.jasmin.ac.uk | ||
User fred | ||
ForwardAgent yes | ||
Host *.jasmin.ac.uk !login*.jasmin.ac.uk !xfer*.jasmin.ac.uk !nx*.jasmin.ac.uk | ||
ProxyJump login-01.jasmin.ac.uk | ||
``` | ||
|
||
Then you when you connect to any JASMIN host (other than a login or transfer host), it will go via login-01: | ||
|
||
{{<command user="user" host="localhost">}} | ||
ssh sci-vm-01.jasmin.ac.uk | ||
{{</command>}} | ||
{{<command user="fred" host="sci-vm-01">}} | ||
## now on sci server | ||
{{</command>}} | ||
|
||
If on your local machine you have also set up a domain search path for hostname lookups that includes `jasmin.ac.uk` so that you can use short hostnames e.g. `ssh sci-vm-01`, then you will also need to add the following lines so that ssh converts these to full hostnames -- otherwise the above wildcard will not match when you do this. | ||
|
||
```config | ||
CanonicalizeHostname yes | ||
CanonicalDomains jasmin.ac.uk | ||
``` | ||
|
||
This sort of configuration is useful for connections needed by remote editing/development tools such | ||
as VSCode. The example above relies on having your key loaded locally in an ssh-agent. | ||
|
||
|
@@ -127,4 +154,5 @@ Host Sci1ViaLogin01 | |
HostName sci-vm-01.jasmin.ac.uk | ||
ProxyJump [email protected] | ||
IdentityFile ~/.ssh/id_ecdsa_jasmin | ||
``` | ||
``` | ||
|