Skip to content

VNC Setup

Tarik Viehmann edited this page Oct 29, 2024 · 1 revision

VNC Account Setup on KBSG Workstations

This document describes how you can set up your KBSG account such that you can work on a workstation remotely via VNC.

KBSG Account Setup

If you don't have a KBSG account yet, please contact [email protected]. We will create an account for you that allows you to access all KBSG workstations. All workstations use an NFS mount for /home, therefore, you can switch between workstations seamlessly.

SSH Bootstrapping

Setup when you have access to a lab machine

  1. Create a SSH key on the machine from which you want to connect to a lab machine.
  2. On any lab machine, log in to your account
  3. Add the public key of the key pair created in 1. to the file ~/.ssh/authorized_keys (create that file if it does not exist

Proceed with the next section.

Setup when you cannot physically access a lab machine

This is only necessary if

  1. You cannot get physical access to a KBSG workstation (e.g., due to a lockdown).
  2. You don't have SSH access with key authentication yet.

This procedure should only be used as last resort if the normal setup is not possible.

To bootstrap SSH key authentication:

  1. Send an email to [email protected] so we can enable password login

  2. Connect to kirk:

    Your username is the first letter of your first name plus your last name (e.g., thofmann). You will get your password during account creation (see above).

  3. Change your password:

    passwd
    
  4. On your local machine, generate an SSH key if you do not have one yet:

    ssh-keygen
    
  5. Copy the key onto kirk:

    ssh-copy-id [email protected]
    
  6. Verify that you can connect to kirk without typing your password.

  7. Send an email to [email protected] and let us know that you are done.

SSH Configuration

SSH User

  • To overwrite the username (e.g., if your local username does not match your KBSG username), add the following snippet to ~/.ssh/config:

    Host *.kbsg.rwth-aachen.de
      User $USER
    

    where $USER is your KBSG username, e.g., thofmann.

Tunneling

The machine kirk.kbsg.rwth-aachen.de is the only one that is accessible from the public. If you want to connect to a different machine, you need to connect to kirk and then connect to your target machine.

You can also configure SSH ProxyJumping so you don't need to do this manually every time.

  • For a one-shot proxy connection, use -J, e.g.,

    $ ssh -J kirk.kbsg.rwth-aachen.de stargazer.kbsg.rwth-aachen.de
    

    to connect to stargazer via the proxy kirk.

  • To configure proxy jumping permanently, add the following snippet to ~/.ssh/config:

    Host *.kbsg.rwth-aachen.de !kirk.kbsg.rwth-aachen.de
      ProxyJump kirk.kbsg.rwth-aachen.de
    

Connect via VNC

Setup

  1. Let us know that you need VNC access. We will assign you to a primary workstation that you can work on and enable VNC for you.

    Admin: Add user to ansible playbook vnc.yaml.

  2. Set a VNC password. Connect to your workstation and run:

    $ vncpasswd
    

    VNC passwords are not stored in a safe way. Use a throw-away password!

Connect to the workstation

Available workstations:

  • defiant
  • enterprise
  • agamemnon
  • orinoco
  • stargazer
  • pegasus
  • voyager
  • dallas
  • yamato (with GPU)
  • venture (with GPU)
  • alhambra
  • california

Whenever you want to connect to a workstation named $workstation, do the following:

  1. Boot the machine if it is not running already:

    $ ssh kirk.kbsg.rwth-aachen.de wakemachine $workstation
    
  2. On the workstation, run startvnc.bash.

    $ ssh $workstation.kbsg.rwth-aachen.de startvnc.bash
    
  3. The script tells you the command that you need to run to connect to the workstation.

bash alias

With the following function in your ~/.bashrc, you can connect with a single command:

function vnc () {
  ssh kirk.kbsg.rwth-aachen.de wakemachine $1 || (echo "Failed to wake $1"; exit 1)
  ret=1
  while [ $ret -ne 0 ] ; do ping -q -c 1 $1; ret=$?; sleep 1; done
  ssh $1 startvnc.bash
  vncviewer -via $1 $1:${2-1105}
}

where you need to replace 1105 by your respective VNC display (which is in the output of startvnc.bash). After that, just run

$ vnc yamato.kbsg.rwth-aachen.de

to boot yamato, wait for the boot to complete, start VNC and connect to it.

Long-running sessions

By default, a session is automatically terminated after 24 hours. If you need to have a long-running session, e.g., because you are running a benchmark, then create the empty file /tmp/long-session-$USER, e.g., with:

touch /tmp/long-session-$USER

Please remember to remove the file when you no longer need the long-running session.

VNC on Windows

To use VNC on Windows, you need to do the following:

  1. Start the VNC server on the remote, as described above
  2. Set up SSH tunneling, e.g., with PuTTY and Xshell.
    • Set kirk.kbsg.rwth-aachen.de as Host Name
    • Configure a tunnel from local port 5900 to the remote host and port that you want to connect to, e.g., host venture and port 7005. The output of startvnc.bash will tell you which port to use. PuTTY SSH Tunneling Configuration Xshell SSH Tunneling Configuration
  3. Use a VNC client to connect to localhost:5900:
    • With TightVNC:
      • Go to Options -> Scale and select "Auto" to get full screen resolution
    • With TigerVNC:
      • Go to Options -> screen and select "Resize remote session to the local window" and "Full-screen mode"
  4. If necessary, set the screen resolution within the VNC session to your native screen resolution
  5. If VNC Viewer returns the message: "Loopback connections are disabled" or your PC is connected to itself, you can try another local port, such as '5910'.
Clone this wiki locally