Contacts

Linux Remote Desktop. Linux remote desktop Ubuntu remote desktop

If for some reason you need to access a remote machine running Ubuntu via RDP, then don’t despair - anything is possible! There is a tool for this called xrdp. In this tutorial, I will tell you how you can connect to Ubuntu via RDP from Windows.

Installing required packages

We will need to install two packages on the system - xrdp and xorgxrdp, but the second is already in the dependencies of the first, so it is enough to run one command:

Sudo apt install xrdp

Setting up xrdp

For correct operation it is necessary that it is open TCP port 3389 - Make sure your firewall is not blocking this port.
Also, if no desktop environment is installed on the system, then it’s worth installing it, for example Xfce, you can do this with the command:

Sudo apt install xfce4

Also, in the home directory of the user on whose behalf the system will be logged in, a file should be located .xsession which specifies the shell launch command, in our example it is startxfce4(to run xfce). After creating this file, run the command sudo systemctl restart xrdp to update the xrdp configuration (if it was already running).

Run xrdp

To start the service, run the command:

Sudo systemctl start xrdp

and in order for xrdp to start along with the system (optional) the command:

Sudo systemctl enable xrdp

Accordingly, stopping and disabling autostart of the service:

Sudo systemctl stop xrdp sudo systemctl disable xrdp

Connecting from Windows

Open the remote desktop connection menu. A universal way to do this is through “Run” - press Win+R and in the window that opens type mstsc:

In the window that opens, specify the machines with Ubuntu and click “Connect”:

In the invitation that appears, indicate the data account in Ubuntu on behalf of which the connection will take place:

And, after clicking “Ok”, we get into the system:

In this example, Ubuntu 18.04 and Windows 10 were used.

July 28

New versions of Ubuntu already have a built-in VNC server. We will use it standard means. While I was understanding this issue, I had to read a decent number of forums. So, many users write that in version ubuntu 14.04 this trick does not work due to some internal subtleties of the kernel structure. I didn’t go into this question deeply... in any case, if suddenly you are the happy owner of this particular version, you can use the alternative x11vnc server.

It is installed quite simply:

Sudo apt-get remove vino sudo apt-get install x11vnc

In the same article, we will look at the standard VNC server already included in ubuntu by default. How to set everything up?

Let's connect to the remote host.

Connect via ssh to remote computer, which we want to access graphically. At the same time, we must know its ip and login with the password of the user whose screen we want to see. In fact, the data of any user with sudo rights will suit us, but then we will have to adjust some points.

So, let's say on a local network we have a computer running Ubuntu with an IP address of 10.20.0.30 and a user feanor184. We connect to it from the console with the -X key (to launch graphic X):

Ssh -X [email protected]

enter the password and get into the console of our remote computer.

Now, enter in it:

Sudo vino-preferences

and see the graphic window

Check the boxes here:

allow other users to view your desktop — We allow you to view your desktop.

allow other users to control your desktop — We allow you to control the mouse and keyboard remotely.

require the user to enter this password — Be sure to set a password for the connection. You never know who is surfing our network.

show notification area icon: always — We always display the vnc icon at the top of the screen in the tray.

You can also set your own settings - my settings are described here)

Save the settings and disconnect from the remote host.

To connect to the configured computer, we use any client with vnc support.

For example, Remmina is for Linux.

UltraVNC Viewer - for Windows.

Let me remind you once again that in order for the described connection settings to work, the remote computer must be running Ubuntu OS. Installing ubuntu is a separate topic that I would not like to focus on here, so we will skip this step. There are many manuals on this topic on the Internet.

What do we end up with?

We were able to connect to a remote computer running ubuntu and perform any operations on it as if we were sitting at its monitor.

In this article we will look at several ways remote connection from Windows to Ubuntu.

Imagine you are in the same room, sitting in front of a Windows computer; the data you need is on another computer running Ubuntu. If both computers are in the same house, no problem; but what if they are in the same office block?

Why connect to Ubuntu remotely from Windows?

There are several reasons why you might need to connect remotely to your Ubuntu computer. Perhaps you are at work and need to log into your home computer. Alternatively, you may have an Ubuntu computer in one room, a Windows computer in another, and want to run updates on Ubuntu.

Alternatively, perhaps you are using an Ubuntu server. You may have configured it to control the launch of a game such as Counter-Strike or Minecraft. In any case, setting up a remote connection will save a lot of time and effort.

You have two options for establishing a remote connection to your Ubuntu computer: you can use Remote Desktop(RDP) or Virtual Network Computing (VNC).

Let's look at each method in turn.

Find out the IP address of your Ubuntu PC

Before you can connect to your Ubuntu device, you need to know the IP address.

The first method is the simplest. Physically go to your Ubuntu device, press Ctrl + Alt + T to open a terminal and enter the command:

Ifconfig

Look for "inet addr" next to the connection you are on this moment you are using. For example, if you are using Wi-Fi, look for wlan0. If the computer is connected to a network for Ethernet, look for eth0.

Another way to find the IP address is to find the connection icon in the panel, right-click and select Connection details. Here you will find the IP address.

Can't open any of these options? You can also connect to the router directly through your computer's browser.

After logging into the router's administration console, you will be able to see what devices are connected. Just search for your Ubuntu device name, find the IP address and write it down.

1. Connect via SSH

Before you get started, you might want to install PuTTY on your computer (or just try the built-in Windows feature SSH). This will allow you to establish an SSH connection which gives remote access To command line Ubuntu.

To be clear, this is not a remote desktop option as there are no mouse controls. But it's useful to have the tools you'll use for remote installation. However, SSH is often disabled by default, so if it's not installed, you'll have to fix that.

In short, it depends on what Ubuntu version you use and have you used SSH before.

After installation via terminal ( sudo apt install openssh-server) you will be able to establish a remote connection (simply using the IP address and Ubuntu username and password) and use the terminal to install necessary tools for RDP and for VNC.

2. Remote access using Remote Desktop Protocol

The simplest option is to use the Remote Desktop Protocol or RDP. Built into Windows, this tool can be used to create a remote desktop connection in your home network. All you need is the IP address of your Ubuntu device.

While necessary software comes pre-installed on Windows, you will need to install the xrdp tool on Ubuntu. To do this, open a terminal window ( Ctrl + Alt + T) and enter:

Sudo apt install xrdp

Sudo systemctl enable xrdp

Wait for it to install, then launch the Remote Desktop application on Windows using the Start or Search menu. Enter rdp and click on Remote Desktop Connection. Once the application is open, enter the IP address in the Computer field.

Then click the button Show options and add Username for Ubuntu PC. You can click Save to save these settings for use again next time.

Click the button To plug to begin connecting and enter your Ubuntu account password when prompted. After this, the connection will be established, which will give you full access to a remote Ubuntu computer using mouse and keyboard. If you plan to use this connection frequently, you can create a configuration file for it to save time.

Troubleshooting RDP problems

While RDP is a great option for connecting remotely to your Ubuntu computer, with the arrival of Ubuntu 18.04 LTS it is less reliable. There appears to be an issue establishing a remote connection when the account is already logged in on the Ubuntu machine.

So an easy way to get around this is to simply log out the user.

If this is not possible, try switching the RDP connection from using the Xorg server to using X11rdp, wait until that works, and then try Xorg again.

You can also try to establish a connection after rebooting your Linux machine.

3. Remote access using virtual network (VNC)

Another option with full remote desktop functionality is VNC (Virtual Network Computing). This requires a client application on a Windows PC and a server on Ubuntu.

Install the component on the remote PC TightVNC Server after checking for updates:

Sudo apt update

Install the server:

Sudo apt install tightvncserver

And run:

Sudo tightvncserver

At this point, you will be asked to set a password for the connection. You will also be assigned a desktop number, usually:1. Write it down.


Now that TightVNC Server is configured on Ubuntu, you will need to install the client on Windows. It can be downloaded from www.tightvnc.com/download.php - make sure you select the correct version as it is available in 32-bit and 64-bit.

TightVNC tools are only available as a bundle, so after installation, search for TightVNC Viewer in Windows search.

After launching the viewer, enter the Ubuntu IP address into the host, followed by the desktop number. It might look like this:

192.168.0.99:1

Enter your password when prompted and start working on your remote desktop!

Making TightVNC more secure

By default, TightVNC will encrypt your password, but nothing else. This makes it unsafe for Internet connections. Luckily, it can be made more secure thanks to SSH and Xming.

To do this, download and install the tool from Sourceforge. After that, find the desktop shortcut, right-click and select Properties.


Look for the Shortcut tab, and in the Target field enter the following:

"C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow

Check the box Enable X11 forwarding, then return to session at the top of the menu.


Enter the IP address of the remote device and click Open. In a few seconds, a secure connection to the Ubuntu remote desktop will be available.

Choosing the Right Remote Access Solution

How you use these methods depends on what you want to get out of your remote desktop.

Three main options are available:

  • RDP: He uses Windows protocol Remote Desktop Protocol, via the open source xrdp implementation.
  • VNC: Virtual Network Computing is an alternative to RDP but is less secure.
  • VNC over SSH: Mixing VNC with SSH improves connection security.

You can also use SSH to control the terminal on your Ubuntu computer.

We've shown you three ways to establish a remote connection to your Ubuntu computer or server from Windows. Each of them has its own advantages and disadvantages. But if you just want to get your feet wet with Ubuntu, why not try the Windows Subsystem for Linux available in Windows 10?

Xrdp is an open source tool that allows users to access a Linux remote desktop via Windows RDP.

Apart from Windows RDP, the xrdp tool also accepts connections from other RDP clients such as FreeRDP, rdesktop and NeutrinoRDP

XRDP Requirements

  • xrdp and xorgxrdp packages
  • Listens to 3389/tcp. Make sure your firewall is accepting connections

In this article, I will show how you can remotely connect to Ubuntu Desktop from a Windows computer using the Xrdp tool.

1) Installation on Linux

on Ubuntu 18.04

Firstly, you need to install Xrdp on Ubuntu

# apt install xrdp Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: xorgxrdp Suggested packages: guacamole xrdp-pulseaudio-installer The following NEW packages will be installed: xorgxrdp xrdp 0 upgraded, 2 newly installed, 0 to remove and 256 not upgraded. Need to get 498 kB of archives. After this operation, 3,303 kB of additional disk space will be used. Do you want to continue?

y

You should configure a polkit rule to avoid authentication popup after entering username and password on xrdp login screen in windows

# vim /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf polkit.addRule(function(action, subject) ( if ((action.id == “org.freedesktop.color-manager. create-device" || action.id == "org.freedesktop.color-manager.create-profile" || action.id == "org.freedesktop.color-manager.delete-device" || = “org.freedesktop.color-manager.delete-profile” || action.id == “org.freedesktop.color-manager.modify-device” || action.id == “org.freedesktop.color-manager. modify-profile”) && subject.isInGroup(“(group)”)) ( return polkit.Result.YES; ) ));

restart xrdp service

# systemctl restart xrdp

# systemctl status xrdp ● xrdp.service - xrdp daemon Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: en Active: active (running) since Tue 2018-10-16 02:05:21 WAT; 11min ago Docs: man:xrdp(8) man:xrdp.ini(5) Main PID: 2654 (xrdp) Tasks: 1 (limit: 2290) CGroup: /system.slice/xrdp.service └─2654 /usr /sbin/xrdp

Now make sure that you automatically start the service when the system starts.

# systemctl enable xrdp Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable xrdp

Now you will need to check your IP address because you will need it to connect

# ip add 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:ef:f6:9b brd ff:ff:ff:ff:ff:ff inet 172.16.8.177/24 brd 172.16.8.255 scope global dynamic noprefixroute ens33

My IP address is 172.16.8.177. So keep that in mind.

Xrdp works on port 3389, so be sure to open it.

UFW is disabled by default, so you need to enable the firewall and create a rule for xrdp

# ufw enable # ufw allow 3389/tcp

Now you can continue configuration from the windows side.

On Centos/Redhat 7

Be sure to install the Epel repositories first

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Now install xrdp packages

# yum update && yum -y install xrdp tigervnc-server

Add a rule to your firewall. On Centos/RedHat ufw does not work, but firewalld does.

# firewall-cmd --permanent --zone=public --add-port=3389/tcp

Then restart your firewall

# firewall-cmd --reload

Now enable and restart the xrdp service

# systemctl enable xrdp && systemctl restart xrdp

Check your IP address for remote connection in Windows

2) Connect from Windows

On your windows computer, such as windows 10 in our case, launch the default Remote Desktop Connection tool.

You will need to enter your device's IP address and you will be prompted to enter a username

Ubuntu/CentOS Remote Desktop Access

Enter IP address and username

Now confirm the information and start the connection.

If you are not logged out locally, remote login will fail.

You will now be asked to enter your password

Now confirm your credentials. You can see my Ubuntu's IP address at the top and the login page. Enter your password and enjoy

Remote Desktop allows you to connect to your computer over the Internet using another computer or even a smartphone. You may often need to do something on another computer, even if you are not near it. Ubuntu also has this option.

In this article, we will look at how to set up a remote desktop on Ubuntu 16.04, as well as how to connect to it using various devices. We will use VNC as the remote access protocol; it is slow and already outdated, but it is supported everywhere. In Ubuntu 16.04, almost all the software is already installed by default, you just need to change a few settings.

Ubuntu Remote Desktop

As I already said, we will use VNC as the remote access protocol. And as a server - Vino, this program is supplied by default with the distribution. And all you have to do is make a few settings for it to work.

Open the Dash main menu and search for Desktop Sharing.

If the system does not detect anything, this is a common bug. You can run the utility through the terminal. To do this, open a terminal with Ctrl+Alt+T and do:

vino-preferences

Next, in the window that opens, check the box "Allow other users to see your desktop" Then opposite the field "Require password" enter the password that will be used to connect:

That's it, ubuntu remote desktop is configured. And now you can try to connect to your computer using another Linux distribution. But there is one more point. You won't be able to connect from Windows. By default, mandatory encryption is enabled. And this is not supported by all clients. To disable forced encryption you need to install dconf-editor:

sudo apt install dconf-editor

Then open the program and follow the path org.gnome.desktop.remote-desktop there, uncheck the box:

Now you are ready to test your ubuntu remote desktop connection. Open the main menu and find the Remmina remote connection client.

In the connection line, select the protocol VNC, then enter the address, since we are going to check on the local machine, then enter localhost, in other cases you will have to use the computer’s IP address. Next click "Connect":

Immediately the program will ask you for a password to gain remote access to the computer:

And then, in the VNC system, the server will ask whether this client needs to be allowed to connect to the ubuntu 16.04 remote desktop:

Once you approve the connection, you can use the remote desktop. Now is the time to connect from another computer. You can use any VNC client for Linux, Windows or Android and connect to your computer if it is on the local network. In addition, you can access it even via the Internet by creating a private local network, for example, with using hamachi or OpenVPN.

conclusions

In this article, we looked at how to set up a remote desktop on Ubuntu 16.04, as well as how to access it using other devices. Everything is very simple, even simpler than with x11vnc, for which you need to create several configuration files. If you have any questions, ask in the comments!

Related posts:


Did you like the article? Share it