Remote desktop

Z MetaCentrum
Skočit na navigaci Skočit na vyhledávání
Metacentrum wiki is deprecated after March 2023
Dear users, due to integration of Metacentrum into https://www.e-infra.cz/en (e-INFRA CZ service), the documentation for users will change format and site.
The current wiki pages won't be updated after end of March 2023. They will, however, be kept for a few months for backwards reference.
The new documentation resides at https://docs.metacentrum.cz.

Quick start I - Run GUI desktop in a web browser

The easiest way how to use GUI applications is by initialization of the entire GUI environment in your favourite web browser. To start the GUI environment in Metacentrum, only a few basic steps are needed:


ZarovkaMala.png Note: Access GUI through a web browser is an experimental feature. Please let us know if it does not work. You can contact us on meta@cesnet.cz.

1) Login to any frontend

2) Start an interactive job (necessary for longer/more demanding work with GUI) and reserve the appropriate amount of resources.

(BULLSEYE)hoidekr@minos:~$ qsub -I -l select=1:ncpus=2:mem=30gb:scratch_local=40gb -l walltime=5:00:00

3) Load the module gui and run command gui start.

(BUSTER)hoidekr@elmo3-1:~$ module add gui
(BUSTER)hoidekr@elmo3-1:~$ gui start
*****************************************
 Your VNC session has been started.
 The connection details are as follows:
   Remote Host : localhost
   Port        : 10092
   Use SSH tun.: yes
   SSH Server  : elmo3-1.hw.elixir-czech.cz
   SSH User    : hoidekr
   VNC Password: 0x0nldJ8
   Display     : :24
   SSH tunnel  : ssh -TN -f hoidekr@elmo3-1.hw.elixir-czech.cz -L 10092:localhost:10092
*****************************************
      ---- EXPERIMENTAL ----
   URL         : https://gui.metacentrum.cz/hoidekr/elmo3-1/10092/vnc.html?path=hoidekr/elmo3-1/10092/websockify&password=0x0nldJ8&resize=scale&autoconnect=true
*****************************************


4) Copy&paste the entire URL to your web browser, login with preferred identity provider (IdP) credentials. For example, when you select MetaCentrum as IdP, then use your MetaCentrum username and password.

MetaCentrum login.png


5) In the end, use leftdown corner menu and logout.

VNC logout.jpg

Quick start II - Run GUI desktop in a VNC session

Another easy way how to start GUI is via some VNC client. The following brief tutorial utilizes the TightVNC client.:

1) Login to any frontend

2) Start an interactive job (necessary for longer/more demanding work with GUI) and reserve the appropriate amount of resources.

(BULLSEYE)vorel@minos:~$ qsub -I -l select=1:ncpus=2:mem=30gb:scratch_local=40gb -l walltime=5:00:00

3) Load the module gui and run command gui start.

(BUSTER)vorel@elmo3-4:~$ module add gui
(BUSTER)vorel@elmo3-4:~$ gui start
*****************************************
 Your VNC session has been started.
 The connection details are as follows:
   Remote Host : localhost
   Port        : 11670
   Use SSH tun.: yes
   SSH Server  : elmo3-4.hw.elixir-czech.cz
   SSH User    : vorel
   VNC Password: KtXPCBcl
   Display     : :20
   SSH tunnel  : ssh -TN -f vorel@elmo3-4.hw.elixir-czech.cz -L 11670:localhost:11670
*****************************************
      ---- EXPERIMENTAL ----
   URL         : https://gui.metacentrum.cz/vorel/elmo3-4/11670/vnc.html?path=vorel/elmo3-4/11670/websockify&password=KtXPCBcl&resize=scale&autoconnect=true
*****************************************


4) Open a new window in your VNC client and fill all required values displayed by gui start command.

01 VNC new.png 02 VNC udaje.png


5) Click on the Connect button and, if necessary, agree with the access to the unknown machine.

03 VNC ssh.png


6) You will be asked to fill two passwords. First one is an ordinary MetaCentrum password. Second one is a VNC Password generated by gui start command. Finally, click on Login button and the GUI session will start.

04 VNC heslo-meta.png 05 VNC heslo-vnc.png


7) In the end, use leftdown corner menu and logout.

VNC logout.jpg

General information

VNC session, server-client connection

When using software with a graphical interface (GUI), the user needs to establish a connection for graphical output between his/her PC and a Metacentrum machine.

To do this, we use a so-called VNC session (Virtual Network Computing) between a Metacentrum machine (server side) and user's local PC (client side).

Security and SSH tunneling

However, the protocol that VNC uses to transfer data between a remote server and a local PC is not secure and is prone to man-in-the-middle attacks. That's why a VNC session must be covered by an additional layer of security that encrypts all communication.

As a default choice, we use SSH protocol as a method of encryption. This is so-called SSH tunneling, because the open communication is hidden ("tunneled") by SSH encryption. The second way is to use noVNC service via the web browser.

Desktop resolution

Please note, that choosing the correct remote desktop resolution may be crucial for a good user experience. The default screen resolution of our VNC server is FHD (1920x1080). It can be changed via the -g option (an argument of gui start command) or scaled using -S option (see below).

The best results can be obtained when local and remote screen sizes are in a ratio 1:1. Otherwise, letter fonts are blurred. I.e. if your display is FHD and you plan run VNC client in fullscreen mode, the result should be fine. However, if you plan to run the VNC in windowed mode, the remote display must be a bit squeezed on your local screen because of window decorations (title bar, slides, frame) resulting in ugly font letters. In such a case it is better to decrease the size of the remote desktop when starting it (-g parameter).

In the case that icons and letter fonts are too small, consider start a smaller remote desktop and scale it either on client side (easy way, usually via some icon or menu checkbox) or on the server side (some VNC clients do not support local scaling) using -S option. I.e. combination of parameters -g 1000x800 -S 2000x1600 will start remote desktop with resolution 1000x800 and scale it twice in X and Y direction. Again, uneven scaling may cause blurred results...

On screens with high resolution, the best results may be achieved simply by choosing bigger xterm font, either from xterm menu (Ctrl+right mouse button - note that Ctrl key is usually implemented as a SW key from menu of VNC client) or by using parameters like:

xterm -fs 16 -fa 'Monospace'

You can also specify xterm font in. Xdefaults file. However, it's beyond the scope of this documentation. To give you an idea of what to expect, can check the following table:


Resolution comparison (click to enlarge)
-g 3840x2160 -g 3840x2160 -g 1920x1080 -g 1920x1080 -g 3840x2160
window maximized fullscreen mode window maximized fullscreen mode increased fonts
-g 3840x2160, window maximized -g 3840x2160, fullscreen mode -g 1920x1080, window maximized -g 1920x1080, fullscreen mode -g 3840x2160, increased fonts

Usage

Establish VNC session: server side

Firstly it is necessary to initialize the GUI on the MetaCentrum node.

Start interactive job:

(BULLSEYE)hoidekr@minos:~/gui$ qsub -I -l select=1:ncpus=1:mem=4gb:scratch_local=10gb -l walltime=2:00:00

Start VNC session:

Once the job has started, load module for gui (module add gui) and start VNC session (gui start) with SSH tunneling enabled (default).

(BULLSEYE)hoidekr@minos:~$ module add gui 
(BULLSEYE)hoidekr@minos36:~$ gui start
*****************************************
 Your VNC session has been started.
 The connection details are as follows:
   Remote Host : localhost
   Port        : 11538
   Use SSH tun.: yes
   SSH Server  : minos36.zcu.cz
   SSH User    : hoidekr
   VNC Password: iWxZ8Ci2
   Display     : :62
   SSH tunnel  : ssh -TN -f hoidekr@minos36.zcu.cz -L 11538:localhost:11538
*****************************************
      ---- EXPERIMENTAL ----
   URL         : https://gui.metacentrum.cz/hoidekr/minos36/11538/vnc.html?path=hoidekr/minos36/11538/websockify&password=iWxZ8Ci2&resize=scale&autoconnect=true
*****************************************

There are several other parameters of gui command you may find useful (see gui --help):

  • gui start [-g GEOMETRY] [-c COLORS] ... starts a VNC session
  • flag -g GEOMETRY ... specifies the required screen geometry (e.g. -g 1280x1024 - default is 1280x768)
  • flag -S|--scale ... specifies the scaled geometry of base ("1920x1080") geometry (i.e. 3840x2160), changing the desktop size AND sizes of icons and fonts
  • flag -c COLORS ... specifies the required color depth in bits(e.g. -c 16 - default is 24)
  • flag -r|--repeat ... turn on keyboard autorepeat (may cause problem in case of slow/laggy connection, default is off)
  • gui info [-p] ... displays information about running VNC sessions on the local node
  • flag -p ... allows to show the VNC session passwords as well
  • gui traverse [-p] ... displays information about running VNC sessions across all the MetaCentrum nodes
  • flag -p ... allows to show the VNC session passwords as well
  • warning: processing of this command may take long time
  • gui stop DISPLAYID ... stops a VNC session (DISPLAYID may be omitted if single session is running)
  • gui kill DISPLAYID ... kills a VNC session (DISPLAYID may be omitted if single session is running)


Example 1: The gui info -p command will show information about running session/s on the actual node (minos1 for this example).

(BULLSEYE)hoidekr@minos1:~$ gui info -p
*****************************************
 Your running VNC sessions are:
   display tunnel machine:port (password)
   :62     SSH    minos36.zcu.cz:10222  (kizFGtpn)
*****************************************

Example 2: The gui stop :62 command will terminate running session.

(BULLSEYE)hoidekr@minos1:~$ gui stop :62
The VNC session (display ':62') running at port 10222 has been successfully stopped...

Example 3: The gui traverse command will search all nodes and show running sessions (if any).

(BULLSEYE)hoidekr@minos1:~$ gui traverse
*****************************************
 Your running VNC sessions across all the MetaCentrum machines are:
 (Warning: this may take a while...)
   display tunnel machine:port
   !!! NO VNC SESSIONS FOUND !!!
*****************************************

Your VNC session will remain active until you the interactive job runs out of time or until you stop it manually (either by command gui stop DISPLAYID or by Start->Logout from graphical interface.

Establish VNC session: client side

Next, you need to establish the connection on the client side, i.e. on your local PC.

Connecting via web browser

For the connection via web browser, please follow the instruction from chapter Quick start I - Run GUI desktop in a web browser. No special setting on the client side is required.

Connecting via SSH tunnel with VNC client

First step: Create SSH tunnnel

Command gui start prints the command for SSH tunnel. Use this command to set up the tunnel. You will be prompted for your Metacentrum password, type it and hit Enter. Nothing visible happens, and the terminal prompt stays at your local PC.

  • Windows: start cmd.exe - Start menu, type cmd, select Command Prompt. Run command for SSH tunnel in shell window
  • Linux: use a standard shell to run the command for the SSH tunnel.

Second step: Connect VNC client

After setting the tunnel, use address localhost:PORT in your VNC client software. You will be prompted for VNC password (printed with gui start). Type it and hit Enter. You will see the splash (welcome) window.

VNC clients

You'll need a VNC client (a piece of software) to establish a VNC session between your PC and Metacentrum machine.

We recommend:

Remmina (Linux)

Simple VNC client, where desktop scaling seems to work seamlessly, even without fixed aspect ratio or in full screen mode.

sudo apt-get install remmina

TigerVNC (Linux, Windows, Intel-based macOS)

General purpose VNC viewer, available on many platforms.

sudo apt-get install xtigervncviewer

TightVNC (Linux, Windows, macOS)

Multiplatform VNC viewer TightVNC Java Viewer. It needs to have Java JRE installed. Please note, that build-in SSH tunnelling uses old libraries not supporting modern encryption ciphers, hence separate SSH tunnel will be probably needed.

sudo apt-get install xtightvncviewer

Other VNC clients

Other options and specialties

Long-standing desktop session

  • If you need a long-standing remote desktop session with a possibility to reconnect, you can use the following simple example script (for example, named as file.sh):
#!/bin/bash
#PBS -m abe

module add gui
gui -f start
  • The user must submit this script as a batch job (with the specification of requested memory, walltime, CPU, ...). E.g.
skirit$ qsub -l walltime=48:0:0 -l select=1:ncpus=2:mem=20gb:scratch_local=40gb file.sh
  • When the job starts (you will be informed by e-mail), please log in to any frontend as soon as possible and type the commands:
skirit$ module add gui
skirit$ gui traverse -p
*****************************************
 Your running VNC sessions across all the MetaCentrum machines are:
 (Warning: this may take a while...)
   display tunnel machine:port (password)
   :24     SSH    elmo3-3.hw.elixir-czech.cz:10086  (ZSYPlpxc)
*****************************************
  • You will see all running VNC sessions with login information.
  • Use the VNC client for the connection to the running session. If you close the window of the VNC client, the job won't be stopped.
  • After the end of your work, please log out (Penguin on the bottom panel -> Logout). Otherwise job end after exhaust reserved time (walltime).

Connect with Putty in Windows

Establishing SSH tunel in PuTTy
  • open a new Putty connection
  • first, fill in the SSH server address field (elmo3-3.hw.elixir-czech.cz in our example)
  • select Connection > SSH > Tunnels in a side panel
  • enter the PORT number into Source port field (5923 in our example) and set Destination field to localhost:PORT (localhost:5923 in our example)
  • choose Add and Open and enter your Metacentrum password
  • use any VNC client to connect to address localhost:PORT (here localhost:5923) and enter the VNC password (n0pTu237 in our example)

Connect with remote desktop: only Windows 10 and newer

You can use a remote graphical desktop on your computer with Windows 10.

VcXsrv X Server icon

Requirements:

1. Installed X Server environment VcXsrv X Server on your computer with Windows. You can directly download the latest version from this page.

2. Installed Windows Subsystem for Linux (WSL), version 1 or 2. You can find many tutorials describing this step on the Internet, e.g. https://docs.microsoft.com/en-us/windows/wsl/install-win10 Following steps are tested on Linux distribution Ubuntu 18.04 LTS and Ubuntu 20.04 LTS.

3. It is best practice to keep the WSL environment updated, you can enforce the update process by:

sudo apt update && sudo apt upgrade

4. In the WSL environment you have to install a VNC viewer, you can do it by the command:

sudo apt install xtightvncviewer

5a. In case of using WSL1 - append this line at the end of your .bashrc file. Open this file in your favorite text editor, e.g. nano ~/.bashrc

export DISPLAY=:0.0

5b. In case of using WSL2 - append these two lines at the end of your .bashrc file. Open this file in your favorite text editor, e.g. nano ~/.bashrc

export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=1
Options of VcXsrv X Server icon - the first screen

1. Start VcXsrv X Server in your Windows environment, e.g. by clicking on the Icon XLaunch. While using WSL1 you can have all options to its default values. In the case of WSL 2 you should tick the option "Disable access control".

2. Now you can start WSL (open new terminal), and you can continue by steps described in section Linux.

Connect VNC in Linux

Open a new terminal and type the following command:

$ ssh -TN -f USERNAME@SSH_SERVER_NAME -L PORT:localhost:PORT 
$ ssh -TN -f melounova@elmo3-3.hw.elixir-czech.cz -L 5923:localhost:5923 # e.g.

You will be prompted for your Metacentrum password type it and hit Enter. Nothing visible happens, and the terminal prompt stays at your local PC.

In the same terminal run any VNC client. In this example we use xtightvncviewer

melounova@melounova-ThinkCentre-E93:~$ xtightvncviewer localhost:PORT
melounova@melounova-ThinkCentre-E93:~$ xtightvncviewer localhost:5923 # e.g.

You will be prompted for VNC password. Type it and hit Enter. You will see the splash (welcome) window.

Run chosen GUI application

You should now see a welcome splash screen:

In this case, terminal launcher is at the bottom of the welcome VNC-client window

At the bottom panel of the splash screen on the left, there is an icon for the terminal. Double-click on the icon. A terminal window opens on the splash screen.

To run chosen GUI application, proceed as in a standard interactive job. If you wish, for example, to run ANSYS Workbench, type

module add ansys-18.2
runwb2 # run new Ansys Workbench project

Then the application's GUI interface will appear on your screen.

Run GUI application (Ansys Workbench in this case)