User Tools

Site Tools


ssh:tipsandtricks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ssh:tipsandtricks [2023/08/25 08:18] – [Remote Access to your Server] jansenssh:tipsandtricks [2025/05/20 08:25] (current) – [Example 3] jansen
Line 23: Line 23:
 ==== Example 1 ==== ==== Example 1 ====
  
-Establish an SSH connection to a machine called <server>: ''<server>.strw.leidenuniv.nl'' via our SSH server ''ssh.strw.leidenuniv.nl''+Establish an SSH connection to a machine called <server>: ''SERVER.strw.leidenuniv.nl'' via our SSH server ''ssh.strw.leidenuniv.nl''
  
 <code bash> <code bash>
-ssh -o ProxyCommand="ssh -W %h:%p username@ssh.strw.leidenuniv.nl" username@<server>.strw.leidenuniv.nl+ssh -o ProxyCommand="ssh -W %h:%p username@ssh.strw.leidenuniv.nl" username@SERVER.strw.leidenuniv.nl
 </code> </code>
  
Line 37: Line 37:
 <code> <code>
 # cat $HOME/.ssh/config # cat $HOME/.ssh/config
-Host <server>.strw.leidenuniv.nl server+Host SERVER.strw.leidenuniv.nl SERVER
      ProxyCommand /usr/bin/ssh -W %h:%p ssh.strw.leidenuniv.nl      ProxyCommand /usr/bin/ssh -W %h:%p ssh.strw.leidenuniv.nl
      User username      User username
 </code> </code>
  
-Once this configuration is in place, a simple ''ssh <server>'' will get you to your workstation.+Once this configuration is in place, a simple ''ssh SERVER'' will get you to your workstation. Of course, substitute the name of the server you want to use.
  
 ==== Example 3 ==== ==== Example 3 ====
 More recent versions of ssh (including ssh on MacOS) also have the option ''ProxyJump'' which has a somewhat easier syntax. When using that option, the examples become: On the commandline: More recent versions of ssh (including ssh on MacOS) also have the option ''ProxyJump'' which has a somewhat easier syntax. When using that option, the examples become: On the commandline:
 <code bash> <code bash>
-ssh -o ProxyJump="username@ssh.strw.leidenuniv.nl" username@<server>.strw.leidenuniv.nl+ssh -o ProxyJump="username@ssh.strw.leidenuniv.nl" username@SERVER.strw.leidenuniv.nl
 </code> </code>
 +or if your ssh client has the ''-J'' option:
 +<code bash>
 +ssh -J username@ssh.strw.leidenuniv.nl username@SERVER.strw.leidenuniv.nl
 +</code>
 +
  
 And in the ''.ssh/config'' file: And in the ''.ssh/config'' file:
 <code> <code>
 # cat $HOME/.ssh/config # cat $HOME/.ssh/config
-Host <server>.strw.leidenuniv.nl server+Host SERVER.strw.leidenuniv.nl SERVER
      Proxyjump ssh.strw.leidenuniv.nl      Proxyjump ssh.strw.leidenuniv.nl
      User username      User username
 </code> </code>
ssh/tipsandtricks.1692951480.txt.gz · Last modified: by jansen