Skip to content

Commit e7a43a3

Browse files
authored
Merge pull request #207 from cedadev/proxyjump_wildcard
add wildcard example for proxyjump - also change user in command prompt in other examples
2 parents 1969c65 + 5748988 commit e7a43a3

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

content/docs/interactive-computing/login-servers.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ The connection via a login server can be done either with 2 hops, or using a log
7878
{{<command user="user" host="localhost">}}
7979
8080
{{</command>}}
81-
{{<command user="user" host="login-01">}}
81+
{{<command user="fred" host="login-01">}}
8282
8383
## no -A needed for this step, if no onward connections from sci server
8484
{{</command>}}
85-
{{<command user="user" host="sci-vm-01">}}
85+
{{<command user="fred" host="sci-vm-01">}}
8686
## now on sci server
8787
{{</command>}}
8888

@@ -91,7 +91,7 @@ ssh [email protected]
9191
{{<command user="user" host="localhost">}}
9292
9393
{{</command>}}
94-
{{<command user="user" host="sci-vm-01">}}
94+
{{<command user="fred" host="sci-vm-01">}}
9595
## now on sci server
9696
{{</command>}}
9797

@@ -110,10 +110,37 @@ You could then simply connect to `Sci1ViaLogin01`:
110110
{{<command user="user" host="localhost">}}
111111
ssh Sci1ViaLogin01
112112
{{</command>}}
113-
{{<command user="user" host="sci-vm-01">}}
113+
{{<command user="fred" host="sci-vm-01">}}
114114
## now on sci server
115115
{{</command>}}
116116

117+
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:
118+
119+
```config
120+
Host *.jasmin.ac.uk
121+
User fred
122+
ForwardAgent yes
123+
124+
Host *.jasmin.ac.uk !login*.jasmin.ac.uk !xfer*.jasmin.ac.uk !nx*.jasmin.ac.uk
125+
ProxyJump login-01.jasmin.ac.uk
126+
```
127+
128+
Then you when you connect to any JASMIN host (other than a login or transfer host), it will go via login-01:
129+
130+
{{<command user="user" host="localhost">}}
131+
ssh sci-vm-01.jasmin.ac.uk
132+
{{</command>}}
133+
{{<command user="fred" host="sci-vm-01">}}
134+
## now on sci server
135+
{{</command>}}
136+
137+
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.
138+
139+
```config
140+
CanonicalizeHostname yes
141+
CanonicalDomains jasmin.ac.uk
142+
```
143+
117144
This sort of configuration is useful for connections needed by remote editing/development tools such
118145
as VSCode. The example above relies on having your key loaded locally in an ssh-agent.
119146

@@ -127,4 +154,5 @@ Host Sci1ViaLogin01
127154
HostName sci-vm-01.jasmin.ac.uk
128155
129156
IdentityFile ~/.ssh/id_ecdsa_jasmin
130-
```
157+
```
158+

0 commit comments

Comments
 (0)