xfreerdp RDP client on Ubuntu

Introduction

xfreerdp is the command for launching the FreeRDP client, which allows connecting to RDP and XRDP servers.

Before installation

To use xfreerdp you first need to install an X server . For example, Gnome or Xfce.

Install Gnome:

sudo apt update
sudo apt install ubuntu-desktop

Install xfce:

sudo apt update
sudo apt install xubuntu-desktop

Installation

sudo apt install freerdp2-x11

Reading package lists... Done Building dependency tree Reading state information... Done freerdp2-x11 is already the newest version (2.2.0+dfsg1-0ubuntu0.20.04.2). 0 upgraded, 0 newly installed, 0 to remove and 86 not upgraded.

Usage

xfreerdp [file] [options] [/v:<server>[:port]]

Syntax

/flag (activates a flag)
/option: (specifies an option and its value)
+toggle -toggle (turns a toggle on or off; here '/' is a synonym of '+')

Direct connection

Connect to a host by IP and user name.

xfreerdp /v:192.168.0.2 /u:andrei

Additionally specify the port

xfreerdp /v:192.168.0.2 /u:andrei /t:9119
xfreerdp /v:192.168.0.2 /u:andrei /port:9119

Connect the clipboard

xfreerdp +clipboard /v:192.168.0.2 /u:andrei /t:9119

audio-mode

Choose the audio mode

xfreerdp /v:192.168.0.2 /u:andrei /port:9119 /audio-mode:1

Create a shared directory

Example: a client on Ubuntu connects to a XRDP server on CentOS and creates a shared directory

xfreerdp /v:192.168.0.2 /u:andrei /port:9119 /drive:s_share,/tmp/client_share

On the client the directory is shared

/tmp/client_share

On the server a directory is created (andrei will be replaced with your user name)

/home/andrei/thinclient_drives/s_share

When connecting to CentOS 7 I noticed that a directory name longer than 8 characters is truncated

Connecting over xrdp from Ubuntu to CentOS with a shared directory, image from www.aredel.com
Connecting from Ubuntu to CentOS

As you can see in the screenshot, on the server a disk is created thinclient_drives in which the directory is located s_share

If initially /tmp/client_share was empty, no files will be shared

You can check the contents of the shared directory on the server by running

ls /home/$(whoami)/thinclient_drives/s_share

On the client create a file test-share.md

touch /tmp/client_share/test-share.md

Check whether it is visible on the server

ls /home/$(whoami)/thinclient_drives/s_share

test-share.md

If the file appeared, the shared directory works.

Connect through an intermediary

We connect to 10.1.100.200 through andrei.server.com

xfreerdp /v:andrei.server.com /u:"tester|10.1.100.200|serv_user" /p:Password

Connecting to Windows Server

If you connect to Windows Server with freerdp and specify a shared directory as follows:

The directory /tmp/client_shar on Ubuntu will correspond to the directory win_share on Windows

xfreerdp +clipboard /v:192.168.56.115 /u:"andrei|192.168.56.174|andrei" /p:Password /t:3389 /audio-mode:1 /drive:win_share,/tmp/client_share

Connecting over xrdp from Ubuntu to Windows Server with a shared directory, image from www.aredel.com
Connecting from Ubuntu to Windows Server

The screenshot shows that the shared directory is created in Network → Hostname

When trying to enter this directory you may get an error

Network Error

Windows cannot access \\DESKTOP\share

You do not have permission to access Windows cannot access \\DESKTOP\share. Contact your network
administrator to request access.

Connecting over xrdp from Ubuntu to Windows Server with a shared directory, image from www.aredel.com
Connecting from Ubuntu to Windows Server

Even though the directory is created for the user andrei and the user andrei is logged in, the directory cannot be entered.

Debug

If something does not work, you can save the connection logs to a file, having first set DEBUG mode with WLOG_LEVEL

WLOG_LEVEL=DEBUG xfreerdp /v:10.1.102.72 /u:andrei /p:secret > xfreerdp.log

Article author: Andrei Olegovich