Hints, Tips, and Tricks

How can I change my default shell?

Please submit a change request to MPCDF helpdesk. Currently, bash, tcsh, and csh are supported, where bash is the recommended choice. Other shells such as zsh or ksh are installed on the systems and can be invoked manually, if desired.

How can I launch ssh-agent in a terminal session?

Run the commands

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

once to unlock an SSH key in your terminal session. For the lifetime of that session, you won’t be asked to type the password for that particular key which is convenient when working with git in combination with remote repositories such as MPCDF GitLab.

How can I avoid having to type my password repeatedly? How can I tunnel through the gateway machines?

An SSH ControlMaster setup establishes a connection once and reuses that connection for subsequent logins from the same machine. In addition, SSH tunnels through jump hosts can be configured using the ‘ProxyJump’ keyword (for OpenSSH 7.3 and newer), older SSH versions use ‘ProxyCommand’. ControlMaster and ProxyJump/ProxyCommand can be combined as shown below.

Please note that per default only a maximum of 10 sessions is supported within a single ControlMaster instance.

The following code snippet demonstrates a ControlMaster configuration for an OpenSSH client to log into ‘gate1’. In addition it sets ‘gate1’ as a jump host to log into the HPC systems. Alternatively, ‘gate2’ can be used.

You can find your SSH client configuration on your local machine at ~/.ssh/config. If this file doesn’t exist yet you need to create it. Add the following configuration to it and replace YOUR_USER_NAME with your actual MPCDF user name:

# SSH configuration taken from https://docs.mpcdf.mpg.de/faq/

# Correctly resolve short names of gateway machines and HPC nodes
Match originalhost gate*,cobra,raven
    CanonicalDomains mpcdf.mpg.de
    CanonicalizeFallbackLocal no
    CanonicalizeHostname yes

# Keep a tunnel open for the day when accessing the gate machines
Match canonical host gate*
    User YOUR_USER_NAME
    Compression yes
    ServerAliveInterval 120
    ControlMaster auto
    ControlPersist 10h
    ControlPath ~/.ssh/master-%C

# Keep a tunnel open for the day when accessing the HPC nodes
Match canonical host cobra*,raven*
    User YOUR_USER_NAME
    Compression yes
    ControlMaster auto
    ControlPersist 10h
    ControlPath ~/.ssh/master-%C
    # OpenSSH >=7.3
    ProxyJump gate1
    # OpenSSH <=7.2
    #ProxyCommand ssh -W %h:%p gate1

You can now connect to any HPC system directly by executing, e.g.

ssh raven

You only have to type your password, OTP, and password again once and be able to reuse this connection for the rest of the day with any HPC system. Note that scp and rsync use ssh under the hood and benefit in the same way from that configuration.

This example works on Linux and Mac but not on Windows 10 due to limitations of its ssh client. On Windows, the PuTTY SSH client supports a feature similar to ControlMaster: Tick the box “Share SSH connections if possible” before connecting.

How can I access the clusters using a Windows machine?

Please follow the instructions in our step-by-step guide to PuTTY and WinSCP.