Just as you can access a remote console with SSH, you can access a Graphical User Inerface (GUI) with several protocols. In this tutorial I will show you some methods to accomplish this task.

Table of Contents

VNC

Ubuntu

  1. Install a VNC server, like tightvncserver:
    sudo apt install tightvncserver
    
  2. Run the VNC server and add a password.
    vncserver :0
    
    • :0 means you want to use display 0, which corresponds to port 5900. You may need to choose another display number if that display is being used. In that case, change :0 for :1 (which corresponds to port 5901).
  3. Kill the server, because we only run it to create vnc config file.
    vncserver -kill :0
    # change number if applicable
    
  4. VNC config file is in /home/<user>/.vnc/xstartup. Open the file.
  5. Add at the end of the file the start command for your desktop environment:
    # XFCE
    startxfce4 &
    # LXDE
    startlxde &
    # GNOME
    gnome-session &
    
    • In Ubuntu 20.04, using VNC with XFCE will not work as expected (windows will not have title bars).
  6. Start a new VNC server.
    vncserver :1
    
  7. Then, you can connect to your server using its IP and port 5900 if you use display :0, 5901 for display :1, etc.

Arch Linux

  1. Install tigervnc.
    sudo pacman -S tigervnc
    
  2. Run vncpasswd to create a VNC password.
  3. Edit /etc/tigervnc/vncserver.users and add the display number and user you want to use, for example:
    :1=ricardo
    
  4. Create a /home/<user>/.vnc/config file and add (at least) this.
    session=<your-desktop-environment>
    
    • You can see your desktop environment name under /usr/share/xsessions, for example:
      session=xfce
      
    • You can specify more settings, like geometry=1280x720.
  5. Start VNC service, using the display number you want to use.
    sudo systemctl start vncserver@:1.service
    
  6. Finally, you can access your server using its IP and port 5900 for display :0, 5901 for display :1, etc.

NoVNC

NoVNC is VNC with a web browser. Obviously you need a VNC server before enabling NoVNC.

sudo novnc --listen 80 --vnc 127.0.0.1:5900

Go to http://<server-ip>/vnc.html and you will access your server.

XRDP

With XRDP you can connect to your server via RDP protocol. Once installed, you can start it by simply typing xrdp or starting xrdp service.

Default RDP port is 3389.

If you have any suggestion, feel free to contact me via social media or email.