👩‍💻 Remote Access

💡 This is advanced Linux magic! Don't worry about it until you really need and get help before.

How to Establish VNC Connection to Lab PCs

Most lab PCs in the Kao Lab run Ubuntu 22.04 LTS as operating system. This is a free, open-source Linux distribution. If you want to established a Virtual Network Computing (VNC) connection to one of these systems both side of the remote server (Lab PC) and client (Your PC) connection have to be set up properly. Overall this description follows the explanation found here: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-22-04

These are the steps that have worked to establish a connection to the Animal Facilities PC (kaolab-Precision-3660; 158.121.126.111; 192.168.1.79):

VPN Connection:

  • Make sure you are connected to the University of Massachusetts Boston (UMB) Network through a Virtual Private Network (VPN) service. This is easiest done by logging in at remote.umb.edu and downloading the necessary software. Commonly you will have to use remote.umb.edu as VPN connection and your UMB credentials to log in.
  • TightVNC/VNC Server: [SKIP IF NOT ADMIN] An instance of VNC server must be running on the remote server for you to establish a connection. This can be done using TightVNC. Run the following command on your local machine to install TightVNC: `sudo apt install tightvncserver`
  • To start a vncserver instance (virtual desktop) on the remote machine run this command: `vncserver :4` The number 3 is arbitrary but defines the (virtual) display which will be used and referenced later. Keep track of this number for these instructions. Now your vncserver should be running on the remote server on port 5904 (590# is default, 4 is what you set).
  • There is an option to set the VNC password using the following command `vncpasswd` , which is currently set to kaolab. Please do not change this!
  • Lastly, the settings for the server to work are quite specific and need to be verified in a separate file. This file is located in ~/.vnc/xstartup and should NOT BE MODIFIED! It further needs to be made executable by running the following command: `chmod +x ~/.vnc/xstartup` The current default which seems to work has the following content:
    #!/bin/sh
    
    xrdb $HOME/.Xresources
    xsetroot -solid grey
    
    export XKL_XMODMAP_DISABLE=1
    export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
    export XDG_MENU_PREFIX="gnome-flashback-"
    
    gnome-session --session=gnome-flashback-metacity --disable-acceleration-check
    

Connect to Actual Desktop Remote Machine:

[SKIP IF NOT ADMIN] To establish a connection between your local system and the actual desktop on the remote server we will need to install x11vnc on the remote system. Do this by running the following command on Ubuntu 22.04 LTS:

sudo apt-get install x11vnc

Followed by this command to start the x11vnc instance:

x11vnc -auth /home/kaolab/.Xauthority -display :1

Make sure to change the username when accessing a non-default user. This will now allow you to use vncviewer as described below to access the desktop display on the default port 5900.

Connect Local Machine:

To establish a connection between your local system and the remote server we will execute the following command:

ssh -L 59004:localhost:5904 -C -N -f -l yourusername server_ip

59004: Is an arbitrary port selected to be linked on your local machine 5904: Is the port of the vncserver on the remote machine ot be linked to yourusername: In this case this is the username on the remote machine which you want to log in as. If not otherwise specified you should use kaolab as username. server_ip: This is the server IP address to be reached. Animal Facilities is: 192.168.1.119 or 158.121.126.111. To reach other systems this and the username must be adjusted.

Check here for more explanation on the other flags.

Access VNC:

To access the VNC server on the remote machine you need to install a VNC Viewer Program. This can be RealVNC for Windows and Mac or TigerVNC for linux. This enables a connection to be accessed through which you can use the virtual desktop remotely. To do so set up a connection to localhost:5904 (vnc; virtual) or localhost:5900 (x11vnc, actual) and authenticate using the password (see Step 2: vncpasswd; DO NOT RUN THIS COMMAND!). This should open a window showing the remote desktop on your local machine.

💡 Further instruction on how to set up and use x11vnc can be found here: [https://linuxconfig.org/how-to-share-your-desktop-in-linux-using-x11vnc](https://linuxconfig.org/how-to-share-your-desktop-in-linux-using-x11vnc)