Suggested SSH setup for UiO

SSH (Secure Shell) is one of the core tools to access resources at UiO. With the changes to authentication and security at, this document suggests some tips and tricks to help you be efficient with SSH.

Due to the securing of remote access, external access via ssh to servers at UiO is now restricted to specific login services and (usually) require two-factor authentication. This means that you an no longer ssh directly to your office computer, and you will normally need to issue two-factor codes every time you connect to UiO.

To make use of ssh from outside of UiO a bit more comfortable, we can make some configuration changes to ssh on the computer that requires such modifications. This would typically be a laptop or a home computer. Using this configuration, the following will happen:

  1. You will establish persistent sessions to external hosts, so you will not need to use two-factor or your password more than once per host per session.
  2. You will be able to ssh to machines beyond the login nodes automatically, like "ssh mycomputer.uio.no", without manually going via the login node. The "jump" through the login node still happens, but it takes place automatically in the background.

The configuration goes into ~/.ssh/config and looks like this (remember to change UIOUSERNAME to your own username at UiO):

# For all hosts at UiO, *except the login nodes, go via login.math.uio.no
Host *.uio.no !login.math.uio.no !login.uio.no
  User UIOUSERNAME
  ProxyJump UIOUSERNAME@login.math.uio.no

# For the login hosts, establish a controlmaster session so we can use ssh
# to the host again without prompts as long as one of the sessions is alive.
Host login.uio.no login.math.uio.no 
  User UIOUSERNAME
  ControlMaster auto
  ControlPath ~/.ssh/%r@%h:%p
  ControlPersist 10m
Published Apr. 17, 2023 12:29 PM - Last modified May 4, 2023 12:21 PM