SIGN IN / UP
    opened image

    If you need a graphical user interface (GUI) on a Linux server, you can install the xfce package, which is light on server resources. To connect to such a server using the familiar RDP protocol, install the xrdp package on the server.

    We will carry out the installation on a server with the Ubuntu 20.04 operating system, but this instruction is also relevant for Ubuntu 18.04. 

    1. After installing the operating system, connect to the server via SSH using the putty program (how to do this) and update the current database with available packages:

    apt update
    2. Install the xfce package

    apt install xfce4


    During installation, the system will ask you to select a Display Manager. Select gdm3 and press Enter
    Дождитесь завершения установки xfce

    3. Install the xrdp package, then configure the xrdp server

     

     

     

    apt install xrdp

     


    After installing the package, the xrdp user will be created under which the xrdp server will run. The user is using the default certificate /etc/ssl/private/ssl-cert-snakeoil.key. Let's add the xrdp user to the ssl-cert group to grant read rights to the specified certificate.

     

     

    adduser xrdp ssl-cert


    After starting a user session (when connecting to the server via RDP), the /etc/xrdp/startwm.sh script is executed. Let's first save the original file

     

    mv /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.bkp

    and add a script to start an RDP session. To edit the file, use the command

     

    vim /etc/xrdp/startwm.sh

    and paste the script code into the opened file

     

    #!/bin/sh
    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi
    exec /usr/bin/startxfce4

    Let's make the script we just edited executable:

     

    chmod 755 /etc/xrdp/startwm.sh

    Restart the xrdp service

     

    systemctl restart xrdp

    and check its status

     

    systemctl status xrdp


    As a result, you should see something like this:

    4. To connect to the server via RDP, the standard port 3389 is used by default. It is this port that the xrdp server listens on.
    It is necessary to provide access to port 3389 in the firewall settings.

    For access from any IP:

     

    ufw allow 3389

    or, if access is needed only from a specific IP address (for example, you can specify the external IP of your home network):

     

    sudo ufw allow from 111.111.111.111 to any port 3389

    * here instead of 111.111.111.111 enter your external IP address.


    5. To connect to a remote desktop, create a separate user by running the command

     

    adduser xrdpuser


    When creating a user, you must enter a password and confirm it (when entering a password, the characters will not be displayed - as it should be). It is not necessary to enter other requested data, you can skip it by pressing Enter.

    If it is necessary to give the user the ability to enable administrative rights, run the command:

     

    gpasswd -a xrdpuser sudo


    6. To work on the server, you can install the software you need.

    For example, the Mozilla Firefox web browser:

     

    apt install firefox 

    The program for working with mail (mail client) Mozilla Thunderbird:

     

     

    apt install thunderbird 

    Office suite (software for working with documents) LibreOffice:

     

    apt install libreoffice 


    7. To connect to the server from the Windows operating system, we will use the standard program "Remote Desktop Connection".

    In the Computer field, enter the IP of your server and click Connect.

    In the certificate request confirmation window, click Yes, after which you can see the server access data request window. Enter the username and password created in step 5:

    After that, the desktop window of the xfce graphical shell installed on the server will open.

    in which you can run standard and previously installed programs.