Software & AppsOperating SystemLinux

How To Setup x11vnc for Remote Access on Ubuntu Server with Graphical Login Screen

Ubuntu 15

In this article, we will be discussing how to set up x11vnc for remote access on an Ubuntu server with a graphical login screen. This can be particularly useful for system administrators who need to manage Ubuntu servers remotely.

Quick Answer

To set up x11vnc for remote access on an Ubuntu server with a graphical login screen, you need to install x11vnc, set up a password, create a service for x11vnc, and restart the system. Once these steps are completed, you can connect to the graphical login screen using a VNC client.

What is x11vnc?

x11vnc is a VNC server that allows you to remotely access the graphical user interface of an Ubuntu server. Unlike other VNC servers that create a separate session, x11vnc allows you to share the actual screen of the X server in real time, similar to tools like TeamViewer and AnyDesk.

Prerequisites

Before we start, ensure that you have:

  • An Ubuntu server with a graphical user interface installed.
  • Sudo privileges on the server.
  • A VNC client installed on your local machine.

Step 1: Installing x11vnc

First, we need to install x11vnc on the Ubuntu server. Open a terminal and run the following command:

sudo apt-get install x11vnc

This command uses apt-get, the package manager for Ubuntu, to install x11vnc.

Step 2: Setting up a Password for x11vnc

For security reasons, it’s recommended to set up a password for x11vnc. To do this, run the following command:

sudo x11vnc -storepasswd /etc/x11vnc.pass

This command will prompt you to enter a password and then store it in the file /etc/x11vnc.pass.

Step 3: Creating a Service for x11vnc

To ensure x11vnc starts automatically on boot, we need to create a service for it. Run the following command to open a new service file in the nano text editor:

sudo nano /etc/init/x11vnc.conf

In the editor, paste the following content:

start on login-session-start

script
 /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
end script

Here’s what each parameter does:

  • -xkb: This option ensures that special keys like Alt+Tab work properly.
  • -auth /var/run/lightdm/root/:0: This specifies the authorization file for the X server.
  • -noxrecord: This disables the X Record extension for capturing.
  • -noxfixes: This disables X server region fixing.
  • -noxdamage: This disables the X Damage extension.
  • -rfbauth /etc/x11vnc.pass: This specifies the password file for VNC.
  • -forever: This makes x11vnc run until stopped, instead of exiting after the first client disconnects.
  • -bg: This makes x11vnc run in the background.
  • -rfbport 5900: This specifies the port on which the VNC server listens.
  • -o /var/log/x11vnc.log: This specifies the log file for x11vnc.

After pasting the content, save the file and exit the editor.

Step 4: Restarting the System

Finally, restart your system to apply the changes. x11vnc should now start as a service before user login, allowing you to connect to the graphical login screen using a VNC client.

Conclusion

Setting up x11vnc for remote access on an Ubuntu server with a graphical login screen can be a straightforward process if you follow the steps above. This setup can be particularly useful for system administrators who need to manage Ubuntu servers remotely. For more information on x11vnc, you can visit the official x11vnc documentation.

How can I access the graphical login screen of my Ubuntu server remotely using x11vnc?

To access the graphical login screen remotely, you can use a VNC client on your local machine and connect to the IP address of your Ubuntu server, along with the VNC port (default is 5900). Make sure you have set up x11vnc and have the necessary password to authenticate.

Can I use x11vnc to access an Ubuntu server without a graphical user interface?

No, x11vnc requires a graphical user interface (GUI) to be installed on the Ubuntu server. It shares the actual screen of the X server, so without a GUI, there is no screen to share.

How can I change the VNC port that x11vnc listens on?

By default, x11vnc listens on port 5900. If you want to change the port, you can modify the -rfbport parameter in the /etc/init/x11vnc.conf file. Simply replace 5900 with the desired port number.

Can I use x11vnc with other VNC clients besides the default one?

Yes, x11vnc is compatible with various VNC clients. You can use popular VNC clients like RealVNC, TightVNC, and TigerVNC to connect to the Ubuntu server running x11vnc.

Is it possible to set up x11vnc without a password for easier access?

While it is possible to set up x11vnc without a password, it is highly recommended to set up a password for security reasons. Without a password, anyone with access to the VNC port can connect to your server.

Leave a Comment

Your email address will not be published. Required fields are marked *