How-To: Connect to the Default Desktop on Linux Remotely

How-To: Connect to the Default Desktop on Linux Remotely

On Linux, it can be a challenge to connect to the default desktop that is seen when the system boots while connected to a monitor. This is largely due to the more flexible desktop environment on Linux distributions that support many more modes of operation.

There are multiple ways to connect to different types of computers and operating systems:

  • SSH is the most popular way to connect to a Linux machine for standard command-line tasks.
  • Remote Desktop (RDP) is one of the most popular ways to connect to a Windows machine to control the graphical user interface.
  • VNC is similar to RDP, but more common on Linux. However, Linux is quite different from Windows as it has multiple desktop screens and display options by default.

Most VNC server implementations create a hidden desktop display by default, which is often not what the end-user prefers unless the VNC server is intended to allocate the host machine as a multi-user server. This article will show how to connect remotely to the default desktop on two of the most popular branches of Linux used on single board computers, Debian-based (Ubuntu, Mint, etc.) and Arch-based (Manjaro, etc.).

This method also works for Debian- and Arch-based systems running on laptops, desktops and servers running on a variety of hardware. This method will not work for systems that use Wayland as the graphical compositing engine.

Installation:

Debian-based systems:

sudo apt update
sudo apt upgrade
sudo apt install x11vnc
x11vnc --usepw -forever

At this point, enter a password to access the machine via VNC. Please note: It's recommended to use a secure password as VNC allows complete control over that machine, although it will take a bit more work to get x11vnc to autostart on boot.

Arch-based systems:

sudo pacman -Syu x11vnc
x11vnc --usepw -forever

At this point, enter a password to access the machine via VNC. Please note: It's recommended to use a secure password as VNC allows complete control over that machine, although it will take a bit more work to get x11vnc to autostart on boot.

Note:
The -forever tag after the x11vnc command keeps the x11vnc server running even after the client system disconnects. Otherwise, only one client session will be allowed, and the x11vnc server will exit after that client disconnects.

On the client system (the system that will be accessing your x11vnc machine):

Windows-based systems:

Download and install tightvncviewer, vncviewer or another VNC viewer - there are a number of them and they are generally open source.

Debian-based systems:

sudo apt install tigervnc-viewer
vncviewer

Arch-based systems:

sudo pacman -Syu tigervnc
vncviewer

Connecting to the target machine:

If your network supports name resolution, you should be able to simply put in the host name of the machine you wish to connect to in the VNCViewer window. If your network does not support name resolution, you'll have to enter the IP address of the machine. If you don't know the IP address, you can check the router's DHCP address table, or use a tool like Angry IP Scanner on Windows or nmap on Linux to help you find the IP address.

Surviving reboots of the target machine:

If you are off-site and your target machine reboots, you won't be able to reconnect to it unless you have x11vnc set in the startup. Setting this up varies by operating system and desktop environment. We have a number of useful articles here that may be of assistance:

Auto-Login: https://ameridroid.com/search?type=article%2Cpage%2Cproduct&q=login* (Check the Posts section)

Alternative:

Another option for accessing files (and the X11-based user interface) on your PinePhone is to use DWS Remote Control available at https://www.dwservice.net/

Conclusion:

With x11vnc server, you should now be able to manage all your systems from wherever you are!

Previous article Home Assistant ODROID-M1 Bundle!

Leave a comment

Comments must be approved before appearing

* Required fields

x