Skip to content
System Status: All systems are operational • Services are available and operational.
Click for detailed status

Euler tunnel

Euler-tunnel is a tool that enables users to establish SSH tunnels directly to running batch jobs on Euler. This is particularly useful for scenarios such as using the VSCode Remote SSH plugin, which otherwise connects only to Euler's login nodes—where computations are not permitted.

Another common use case involves terminal multiplexers like screen or tmux. Euler's load balancer distributes login sessions across 50 nodes, so detached sessions can become orphaned if you reconnect and land on a different node. Euler-tunnel solves this by allowing you to reconnect to existing sessions running within batch jobs.

Initial setup

To use euler-tunnel, you must have passwordless SSH key access to Euler. See: SSH

Next, run the following command on Euler to generate your configuration:

$ euler-tunnel config
[INFO] First time running. Generating ssh server host key.
[INFO] Add this line to your ~/.ssh/known_hosts file on YOUR computer.

euler-tunnel ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVOd5pk+UK9dzO/9/xQRreDyvRaYSVr7xAPc4oNtoBZ euler-tunnel

[INFO] Add this Host block to your ~/.ssh/config file on YOUR computer.

Host euler-tunnel
   User sfux
   ServerAliveInterval 10
   ServerAliveCountMax 10
   # Note: Windows users will have to remove the Control* settings
   #       as that feature uses sockets which don't exist on windows.
   ControlMaster auto
   ControlPath ~/.ssh/cs-%r@%h:%p
   ControlPersist 15
   ProxyCommand ssh sfux@euler.ethz.ch euler-tunnel connect

Follow these instructions to update your known_hosts and config files on your local machine. You may need to add additional SSH settings as required for your environment (e.g. a custom IdentityFile).

Once your SSH configuration is updated, you are ready to use euler-tunnel.

Commands

See euler-tunnel -h.

Usage

Run euler-tunnel start on an Euler login node to submit a batch job. You can pass any standard sbatch options:

euler-tunnel start --time=4:00:00 --cpus-per-task=2 --mem-per-cpu=2G

No command needs to be wrapped with --wrap="". This sets up a batch job you can connect to.

To connect from your local machine, use:

ssh euler-tunnel

This creates an SSH tunnel into your running batch job.

Running commands remotely

After starting a batch job:

$ euler-tunnel start
Submitted batch job 3035916
eu-login-42:~$ euler-tunnel status
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
           3035916 normal.4h euler-tu  asteven  R       0:04      1 eu-g5-047-2

You can run commands through the tunnel from your local computer:

ssh euler-tunnel hostname
eu-g5-047-2

This example runs hostname in the batch job on compute node eu-g5-047-2.

Using VSCode

To connect VSCode to a batch job on Euler:

  1. Start a batch job with euler-tunnel.
  2. Open VSCode on your local computer.
  3. Launch the Remote SSH plugin.
  4. Select "Connect to Host..." and choose euler-tunnel.
  5. VSCode will connect to your running batch job.

If you lose connection, simply restart the Remote SSH plugin and reconnect.

Troubleshooting

Using SSH Agent on Windows

To use the native Windows SSH Agent, open PowerShell as administrator and run:

Set-Service -Name ssh-agent -StartupType Automatic
Set-Service -Name ssh-agent -Status Running