Revision 9 as of 2020-03-29 20:33:04

Clear message

Remote access to a Linux host's desktop with VNC

The following article explains how to access the desktop of a Linux host residing inside the ETH network from another host on the in- or outside by using Virtual Network Computing (VNC)1. Throughout his article, the following placeholders are used:

Connect to the ETH network

If current_host resides outside of the ETH network, you need to connect to it by initiating a VPN connection. The following steps explain the necessary prerequisites.
If current_host is alreay inside the ETH network, skip to the next paragraph.

Know your ETH network password

If you're unsure about your eth_network_password, login on password.ethz.ch with your regular eth_password and change your former eth_network_password to a new password.

Install the VPN client on your current host

Initiate a VPN connection to your Linux host

Start a VNC server on your Linux host

To start a VNC server instance on internal_host, you need to initiate a SSH connection to it.

Initiate a SSH connection to your Linux host

Setup and start the VNC server

Configuration and start of a VNC server works with an ISG-provided wrapper script by issuing the command

vncserver

in your shell connected to internal_host.

Setup and first startup

If this is the first time you start vncserver, you will be asked to provide a password to allow access to the VNC server instance you start now and in the future. It is possible to set the password to allow only observing or also interacting with the VNC session. Select a strong password, as anyone on the ETH network can connect to your internal_host.
The setup followed by the startup process will look like this:

Creating directory /home/eth_username/.vnc......
Creating startup_file /home/eth_username/.vnc/xstartup.....

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n

New 'default' desktop is internal_host:N

Creating default config /home/eth_username/.vnc/config
Starting applications specified in /home/eth_username/.vnc/xstartup
Log file is /home/eth_username/.vnc/internal_host:N.log

Note the virtual display number N of your VNC server appearing after internal_host:. It is needed later to connect your VNC viewer on current_host to the VNC server instance on internal_host or to kill a vncserver process manually.
The default desktop started now is Xfce4. If you prefer a different desktop you have to kill the running vncserver process and start it again with the desktop of your choice.
Otherwise the vncserver process terminates after you log out of your desktop environment.

Terminating a running VNC server process

Issue the command

vncserver -kill :N

in a shell on internal_host.

Choose a non-default desktop

To start the VNC session with a non-default desktop, provide one of the options [xfce|gnome|kde|light|xterm]:

vncserver gnome

Use a VNC viewer to view and control the desktop on your Linux host

VNC viewer software

The listed VNC software contains a viewer component and is available for both Linux and Windows:

The above list is not meant to be complete, feel free to install other solutions on your self-managed computer.

Connect your VNC viewer to the VNC server on your Linux host

/!\ unfinished from here on

If you terminate your VNC viewer without logging out of your desktop environment, your VNC session will stay active and you can reconnect to it later on.

Misc

Check (student) host availability

Check with the command htop if any other users are using internal_hosts resources right now. If they do, log out and log in to a different host.
A list of student hosts can be shown by issuing the command grep tardis /etc/hosts

Advanced usage

Some advanced configuration or usage examples have not yet been migrated from the previous documentation about VNC.

And Mac users?

To be documented. Hint: Everything you need is already available in macOS.