From 32c27d757f96e59f3412069277e982f0c337e5cb Mon Sep 17 00:00:00 2001 From: Alan Iwi Date: Wed, 5 Feb 2025 16:03:09 +0000 Subject: [PATCH 1/2] add wildcard example for proxyjump - also change user in command prompt in other examples --- .../interactive-computing/login-servers.md | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/content/docs/interactive-computing/login-servers.md b/content/docs/interactive-computing/login-servers.md index 505f1426e..366a29f61 100644 --- a/content/docs/interactive-computing/login-servers.md +++ b/content/docs/interactive-computing/login-servers.md @@ -78,11 +78,11 @@ The connection via a login server can be done either with 2 hops, or using a log {{}} ssh -A fred@login-01.jasmin.ac.uk {{}} -{{}} +{{}} ssh fred@sci-vm-01.jasmin.ac.uk ## no -A needed for this step, if no onward connections from sci server {{}} -{{}} +{{}} ## now on sci server {{}} @@ -91,7 +91,7 @@ ssh fred@sci-vm-01.jasmin.ac.uk {{}} ssh -A fred@sci-vm-01.jasmin.ac.uk -J fred@login-01.jasmin.ac.uk {{}} -{{}} +{{}} ## now on sci server {{}} @@ -110,10 +110,37 @@ You could then simply connect to `Sci1ViaLogin01`: {{}} ssh Sci1ViaLogin01 {{}} -{{}} +{{}} ## now on sci server {{}} +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 host), it will go via login-01: + +{{}} +ssh sci-vm-01.jasmin.ac.uk +{{}} +{{}} +## now on sci server +{{}} + +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 fred@login-01.jasmin.ac.uk IdentityFile ~/.ssh/id_ecdsa_jasmin -``` \ No newline at end of file +``` + From 5748988bdeb5245ae19fa3e165b9de2ad97dc987 Mon Sep 17 00:00:00 2001 From: Alan Iwi Date: Wed, 5 Feb 2025 16:08:01 +0000 Subject: [PATCH 2/2] Update login-servers.md clarify description --- content/docs/interactive-computing/login-servers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/interactive-computing/login-servers.md b/content/docs/interactive-computing/login-servers.md index 366a29f61..2d4047756 100644 --- a/content/docs/interactive-computing/login-servers.md +++ b/content/docs/interactive-computing/login-servers.md @@ -125,7 +125,7 @@ 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 host), it will go via login-01: +Then you when you connect to any JASMIN host (other than a login or transfer host), it will go via login-01: {{}} ssh sci-vm-01.jasmin.ac.uk