How to Set Up Remote Desktop on Ubuntu

Ubuntu mug next to a laptop, a phone and Rubik's cube.J.D. Canchila / Shutterstock

Need to get hold of a remote Ubuntu Linux computer? Set up Ubuntu screen sharing and take control remotely when you need it. You can connect to the screen share with any VNC client. We will show you how.

The "screen sharing" built into Ubuntu is a VNC server

When you do an SSH connection on a remote Ubuntu Linux computer, you get a terminal window interface. This is ideal for many tasks, such as system administration, and has the advantage of being a lightweight connection. There is no graph to transmit from the host computer to the local client, so it is easy and quick to configure.

If you want to see graphics applications installed on the remote host of your local computer, you can do it with a PuTTY connection, Which is also easy to install.

But what if you want to go all the way and see the whole office from a distance and as if you were sitting right in front? Simple: You use "screen sharing", also known as desktop sharing.

To do this, you configure screen sharing on the remote computer and connect to it with the remote computer. a VNC client on the local computer. And, you guessed it, it's easy to install.

Although this article focuses on Ubuntu, it's really a GNOME thing. It works just as well on any other Linux that has a GNOME version of its distribution. Manjaro and Fedora, for example, have the same options and settings described below. We followed this process with Ubuntu 18.04 LTS.

How to enable screen sharing on the remote host

These are the settings that you set on the remote Ubuntu computer to which you will connect.

In the system menu, click the Settings icon.

Click on the settings icon in the system menu.

In the "Settings" dialog box, click "Sharing" in the side panel, then click the "Share" toggle.

Click "Off" next to the "Screen Sharing" option to make it "On".

The "Sharing Screen" dialog box appears. Click on the toggle in the title bar to activate it.

When the flip-flop is on, the slider at the bottom of the dialog box also turns On.

By default, "Access Options" is set to "New Connections Must Request Access". This means that each user must confirm each connection. If you try to connect remotely, it will not work. Set up a password. Select the "Request a password" radio button and type a password in the "Password" field.

This password is not associated with any user accounts, but it must be provided by remote clients when logging on. It is limited to eight characters. So be as complex as possible. If you forget the password, you can always repeat these steps to reset it.

After entering a password, close the "Screen Sharing" and "Settings" dialogs.

Encryption is used to transfer and verify the password when a connection request is made. The fact that the rest of the VNC traffic is encrypted depends on the VNC client capabilities. This is no longer a concern about connections across the Internet.

Unless you have a secure VPN between your two sites or if the VNC connection is otherwise protected (by being tunneled via SSH, for example), it is safe to assume that the connection is not encrypted. Avoid opening sensitive or private documents via the connection.

We now need to configure a client to connect to this computer, which brings us to IP addresses.

How to access the remote system via the Internet

Warning: We recommend using VNC only on a local network. Ubuntu Screen Sharing will not let you set a password of more than eight characters. If you want to connect remotely, we recommend that you configure a virtual private network (VPN) server on the network with the remote Ubuntu system. Connect to the VPN from the Internet, and then connect to the VNC system via the VPN. This avoids exposing the VNC server directly to the network. However, if you still want to make the screen sharing server accessible via the Internet, this section explains how.

If you are not on the same network as the remote Ubuntu computer, you will need to connect to it via the Internet. The IP address that a network presents to the Internet is its public IP address. This is actually the IP address of the router, assigned by the server Internet Service Provider (ISP). So, we have to find this IP address.

The easiest way to do this is to type "my IP address" into the Google search bar of the Ubuntu remote computer, then press Enter.

It's good to know, but it's not enough to establish a connection with the remote computer.

Imagine that you want to call someone in a hotel. You can not call their room directly. You call the hotel first and give them the name of the guest you want to talk to. The switchboard operator consults the hotel directory and sends your call to the correct room.

The router on a network acts as the standard operator. The remote network router must therefore be configured to forward VNC connection requests to the Ubuntu PC. This is a networking technique called port forwarding.

But let's go back a bit. Your ISP may have assigned you a static public IP address or a dynamic public IP address. A static public IP address is permanent, while a dynamic public IP address is likely to change when your router restarts. If your public IP address changes regularly, remote computers will not know which IP address to send their connection request to.

The solution is something called dynamic domain name system (DDNS). There are free DDNS providers that you can use. The general process is:

You register with the DDNS provider and receive a static web address.
You configure your router so that it periodically contacts your DDNS provider and informs it of its current IP address.
The DDNS system updates its record of your web address, so that it points to your IP address. This means that the connection requests made to your web address are always transmitted to your current and correct IP address.

RELATED: How to easily access your home network from anywhere with Dynamic DNS

Using our analogy with the hotel, the connection request so far has been passed to the hotel standard. To complete the connection, the router must perform port forwarding.

Routers can send traffic that arrives on a specific port to a specific computer. Once configured to send VNC traffic to a particular computer, all incoming VNC connection requests are directed to that computer.

If you want to use VNC over the Internet, it is advisable to use a non-standard port. By default, the remote Ubuntu computer listens for VNC connection requests on the TCP / IP 5900 port.

This is a well-defined convention, but we still checked it by analyzing the network traffic:

We can hide these details from the outside world using a non-standard port, such as 43025. The remote router must then be configured to forward connection requests for port 43025 – or the port of your choice – to the computer. Ubuntu on port 5900.

RELATED: How to transfer ports on your router

It's like ringing at the hotel and asking to talk to the geek of room 43025. The operator knows that the geek is really in room 5900 and puts your call in communication. The geek does not know which room you have requested and he does not know which one. You do not know which room the geek is in, you do not care.

The conversation between you can continue, and it was the desired result.

How to connect from a Linux system

The client computer that will connect to our Ubuntu computer does not need to run Ubuntu. As we'll see when setting up a Windows client, it's not even necessary to run Linux.

To reinforce the agnostic nature of distribution-related distribution, we will connect from a computer running Manjaro. The steps are the same for other distributions.

We will establish a Virtual Computing Network (VNC) connection. So we have to use a client that can do it. Remmina is a remote desktop client that supports VNC and comes with many Linux distributions, including Ubuntu. It is easy to install (if it is not already the case) from the package manager of other distributions.

Press the Super key between the Ctrl and Alt keys on the left, then type the first letters of "remmina". The Remmina icon appears at the top of the screen.

Click on the icon to launch Remmina.

The Remmina icon.

When the Remmina dialog box appears, click the "+" sign to create a new connection.

The Remote Desktop Preferences dialog box appears. It is here that you enter details about the connection to the remote computer. These can be saved and reused, so you do not need to retype them every time you want to connect.

Provide a "name" for this connection. You can choose anything, but it's something that identifies the computer you're going to connect to.

You can leave the "Group" field blank or give the group a name. If you are configuring many connections, you can group them into categories, such as Linux Computers, Windows Computers, Home Office, Local Branches, and so on.

Select "VNC – VNC Viewer" from the "Protocol" drop-down menu. More fields now appear that Remmina knows which protocol we want to use.

In the "Server" field, enter the IP address or the network name of the remote computer. The "User Name" field is not linked to a Linux user account. you can type anything here. The "password" must be the password that you used when setting up the screen share on the remote Ubuntu machine.

Select a value from the "Color Depth" drop-down menu. Low values ​​respond better, but the screen will be flat and slightly psychedelic. If visual effects do not matter to you and you prefer speed to beauty, choose a low value. The highest values ​​are more like the actual desktop. On slow connections, however, they may be slow to update and mouse movements may be erratic.

Select "Medium" from the "Quality" drop-down menu. If everything seems fine when you're connected, you can adjust it to a higher value for subsequent connections. But to make sure the connection works, "Medium" is a good place to start.

After setting up your connection details, click the "Save" button. You return to the main Remmina window and your new connection is listed there.

The new connection listed in Remmina's main window.

Double-click the connection to connect to the remote Ubuntu computer. The remote computer must be turned on and the person who configured the screen sharing must be connected. He will see a notification that you are logged in and that you control his office, which is only polite.

Remote connection notifying the remote user that another user is controlling his desktop.

It is important to note that you are not connecting to the remote computer. You resume the session of the person already connected.

Remmina shows you the remote desktop in a window of your computer. You can move the mouse and use the keyboard in the same way as if you were sitting in front of the remote computer.

The sidebar icons allow you to enlarge the window, resize the remote desktop for the Remmina window, switch to full-screen mode, and more. Hover your mouse over the icons to get a tooltip on what they do.

Remote Ubuntu desktop in a Remmina VNC session.

After the remote connection is complete, disconnect from the remote computer by clicking the lower icon in the side panel.

How to connect from a Windows system

Windows has compatibility issues with the encryption used in the VNC connection, so we will make the use of encryption optional. This way, computers that use encryption can do this, and those that do not can connect without it.

Warning: All members of your network will be able to listen to the connection. This is another reason why it is good to use it on a local network or via a VPN, not on the Internet!

Use this command on the remote Ubuntu computer to make encryption optional:

gsettings set org.gnome.Vino require-encryption false

If you do not have RealVNC on your Windows computer, download and install. The installation is simple: just click on the "Next" buttons and accept the default values.

When the installation is complete, launch the "VNC Viewer" application from the Start menu. Select "New Connection" in the "File" menu.

The "Properties" dialog box appears. Type the IP address or the network name of the remote Ubuntu server in the "VNC Server" field.

In the "Name" field, enter a name for this connection so that you can identify the computer to which it is connecting. You can provide a label in the "Label" field or leave it blank.

In the "Security" group, leave the "Encryption" drop-down menu on "Let the VNC server choose". Make sure that "Authenticate with Single Sign On (SSO) if possible" and "Authenticate with a Smart Card or Certificate Store if possible" are disabled.

Click "OK" to save your settings. An icon for your new connection appears in the main window.

A new connection icon in the RealNVC main window.

Double-click the icon to connect to the remote computer. You will see a splash screen when the connection is established.

A splash screen in RealVNC when a connection is established.

Because you have made the encryption optional and it will not be used from the Windows computer, a warning dialog box will appear.

Check the "Do not warn me about it on this computer" box and click "Continue".

You see the desktop of the remote Ubuntu computer in the RealVNC window.

Remote Ubuntu desktop in a RealVNC window.

Do not forget that the Windows VNC connection is not encrypted. Do not open any private documents or e-mails using this connection.

Never too far

If you need to access an Ubuntu computer remotely, you now have a simple way to do it. As a bonus, RealVNC also offers a free application for Android smartphones and iPhone. You can configure it by following the same steps above.

realVNC on an Android phone connected to a remote Ubuntu computer.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.