damiano.meda
Posts: 4
Joined: Sun May 14, 2017 12:12 am

How to make XRDP work with clipboard and file transfer

Sun May 14, 2017 3:07 am

Hello guys, I am sharing today a script that installs a custom XRDP. I found a similar script written for Ubuntu, but it was not working for Raspbian and I had to do some adjustment to make it work. It supports file transfer and the clipboard. You missed the copy-paste? Here you go.

Code: Select all

#!/bin/bash
################################################################
# Scriptcd do	_Name : xrdp-install.sh
# Description : Perform an automated custom installation of xrdp
# on raspbian jessie with pixel
# Date : May 2017
# Written by : Damiano Meda
# Version : 1.0
#
# Disclaimer : Script provided AS IS. Use it at your own risk....
#
##################################################################
##################################################################
#Step 1 - Install prereqs for compilation
##################################################################
sudo apt-get update
sudo apt-get upgrade
echo "Installing prereqs for compiling xrdp..."
echo "----------------------------------------"
sudo apt-get -y install libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm xserver-xorg-dev fuse
#Install git 
echo "Installing git software..."
sudo apt-get -y install git 
##################################################################
#Step 2 - Obtain xrdp packages and xorgxrdp packages
################################################################## 
#Go to your Download folder
echo "Moving to the ~/Download folders..."
echo "-----------------------------------"
cd ~/Downloads
#Download the xrdp latest files
echo "Ready to start the download of xrdp package"
echo "-------------------------------------------"
git clone https://github.com/neutrinolabs/xrdp.git
git clone https://github.com/neutrinolabs/xorgxrdp.git
##################################################################
#Step 3 - Compile xorgxrdp package
################################################################## 
#Create this empty file to prevent an error in configuration phase
sudo touch /usr/include/X11/fonts/fontutil.h
cd xorgxrdp 
sudo ./bootstrap 
sudo ./configure XRDP_CFLAGS=-I/${HOME}/Downloads/xrdp/common
sudo make -j 4
sudo make install
cd ..
##################################################################
#Step 4 - Compile xrdp package
################################################################## 
#Compile and make xrdp
echo "Installing and compiling xrdp..."
echo "--------------------------------"
#sudo sed -i.bak 's/which libtool/which libtoolize/g' bootstrap
cd xrdp
sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg
sudo make -j 4
sudo make install
cd ..
################################################################## 
#Step 5 - Final Post Setup configuration
################################################################## 
echo "---------------------------"
echo "Post Setup Configuration..."
echo "---------------------------"
echo "Symbolic links for xrdp"
echo "-----------------------"
sudo cp /etc/xrdp/rsakeys.ini /usr/share/doc/xrdp/rsakeys.ini
#Needed in order to have systemd working properly with xrdp
echo "-----------------------"
echo "Modify xrdp.service "
echo "-----------------------"
#Comment the EnvironmentFile - Ubuntu does not have sysconfig folder
sudo sed -i.bak 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp.service
#Replace /sbin/xrdp with /sbin/local/xrdp as this is the correct location
sudo sed -i.bak 's/sbin\/xrdp/local\/sbin\/xrdp/g' /lib/systemd/system/xrdp.service
echo "-----------------------"
echo "Modify xrdp-sesman.service "
echo "-----------------------"
#Comment the EnvironmentFile - Ubuntu does not have sysconfig folder
sudo sed -i.bak 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp-sesman.service
#Replace /sbin/xrdp with /sbin/local/xrdp as this is the correct location
sudo sed -i.bak 's/sbin\/xrdp/local\/sbin\/xrdp/g' /lib/systemd/system/xrdp-sesman.service
#Issue systemctl command to reflect change and enable the service
sudo systemctl daemon-reload
sudo systemctl enable xrdp.service
#Set keyboard layout in xrdp sessions
cd /etc/xrdp 
test=$(setxkbmap -query | awk -F":" '/layout/ {print $2}') 
setxkbmap -layout $test
sudo xrdp-genkeymap km-0409.ini
echo "Please Restart the Computer"
echo "----------------------------"
Last edited by damiano.meda on Sun May 14, 2017 7:37 pm, edited 1 time in total.

klricks
Posts: 5834
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to make XRDP work with clipboard and file transfer

Sun May 14, 2017 4:21 am

Nice but FYI RealVNC which comes installed in Raspbian Jessie Pixel already has an easy to use file transfer tool and C&P just works either direction.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

damiano.meda
Posts: 4
Joined: Sun May 14, 2017 12:12 am

Re: How to make XRDP work with clipboard and file transfer

Sun May 14, 2017 4:59 am

klricks wrote:Nice but FYI RealVNC which comes installed in Raspbian Jessie Pixel already has an easy to use file transfer tool and C&P just works either direction.
You're right klricks. The point to use this instead is to combine it with windows remote connection. Doing so you won't need to install third party apps on the windows machine. Thanks for the clarification.

tanzi
Posts: 1
Joined: Sat Jun 03, 2017 9:12 pm

Re: How to make XRDP work with clipboard and file transfer

Sat Jun 03, 2017 9:40 pm

Thanks for this script. I am new to Raspberry Pi 3 and Linux in general and have used xrdp successfully before on the pi but was disappointed with the lack of clipboard and file transfer ability. After weeks of trying to use VNC (installed with Pixel) and trying to co-ordinate with other Windows computers I have finally given up on it. I saw your post and decided to try your script. However after removing VNC and running your script I have the following problems.
1. XRDP does not autostart
2. When I start it manually I get a blank screen whenever I try to connect
3. When I try to remove xrdp I get “'xrdp' is not installed, so not removed”
Are you able to throw any light on on these issues? I have tried re-installing but get the same result. The only application I am running on the pi is OpenVPN server. Thanks in advance for your time.

E_Ben
Posts: 2
Joined: Mon Sep 17, 2018 7:47 pm

Re: How to make XRDP work with clipboard and file transfer

Mon Sep 17, 2018 7:57 pm

Thanks for the script.
I experienced an error on my recent raspbian scratch version
Linux raspberrypi 4.14.69-v7+ #1141 SMP Mon Sep 10 15:26:29 BST 2018 armv7l GNU/Linux
where the correct paths in /lib/systemd/system/xrdp-sesman.service and /lib/systemd/system/xrdp.service seem to have changed and thus not require the sed commands. Here is the updated script:

Code: Select all

#!/bin/bash
################################################################
# Scriptcd do	_Name : xrdp-install.sh
# Description : Perform an automated custom installation of xrdp
# on raspbian scratch with pixel
# Date : May 2017
# Written by : Damiano Meda
# Version : 1.0
#
# Disclaimer : Script provided AS IS. Use it at your own risk....
#
##################################################################
##################################################################
#Step 1 - Install prereqs for compilation
##################################################################
sudo apt-get update
sudo apt-get upgrade
echo "Installing prereqs for compiling xrdp..."
echo "----------------------------------------"
sudo apt-get -y install libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm xserver-xorg-dev fuse
#Install git 
echo "Installing git software..."
sudo apt-get -y install git 
##################################################################
#Step 2 - Obtain xrdp packages and xorgxrdp packages
################################################################## 
#Go to your Download folder
echo "Moving to the ~/Download folders..."
echo "-----------------------------------"
cd ~/Downloads
#Download the xrdp latest files
echo "Ready to start the download of xrdp package"
echo "-------------------------------------------"
git clone https://github.com/neutrinolabs/xrdp.git
git clone https://github.com/neutrinolabs/xorgxrdp.git
##################################################################
#Step 3 - Compile xorgxrdp package
################################################################## 
#Create this empty file to prevent an error in configuration phase
sudo touch /usr/include/X11/fonts/fontutil.h
cd xorgxrdp 
sudo ./bootstrap 
sudo ./configure XRDP_CFLAGS=-I/${HOME}/Downloads/xrdp/common
sudo make -j 4
sudo make install
cd ..
##################################################################
#Step 4 - Compile xrdp package
################################################################## 
#Compile and make xrdp
echo "Installing and compiling xrdp..."
echo "--------------------------------"
#sudo sed -i.bak 's/which libtool/which libtoolize/g' bootstrap
cd xrdp
sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg
sudo make -j 4
sudo make install
cd ..
################################################################## 
#Step 5 - Final Post Setup configuration
################################################################## 
echo "---------------------------"
echo "Post Setup Configuration..."
echo "---------------------------"
echo "Symbolic links for xrdp"
echo "-----------------------"
sudo cp /etc/xrdp/rsakeys.ini /usr/share/doc/xrdp/rsakeys.ini
#Needed in order to have systemd working properly with xrdp
echo "-----------------------"
echo "Modify xrdp.service "
echo "-----------------------"
#Comment the EnvironmentFile - Ubuntu does not have sysconfig folder
sudo sed -i.bak 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp.service
#Replace /sbin/xrdp with /sbin/local/xrdp as this is the correct location
#sudo sed -i.bak 's/sbin\/xrdp/local\/sbin\/xrdp/g' /lib/systemd/system/xrdp.service #modified by E_Ben for newer raspbian distro
echo "-----------------------"
echo "Modify xrdp-sesman.service "
echo "-----------------------"
#Comment the EnvironmentFile - Ubuntu does not have sysconfig folder
sudo sed -i.bak 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp-sesman.service
#Replace /sbin/xrdp with /sbin/local/xrdp as this is the correct location
#sudo sed -i.bak 's/sbin\/xrdp/local\/sbin\/xrdp/g' /lib/systemd/system/xrdp-sesman.service #modified by E_Ben for newer raspbian distro
#Issue systemctl command to reflect change and enable the service
sudo systemctl daemon-reload
sudo systemctl enable xrdp.service
#Set keyboard layout in xrdp sessions
cd /etc/xrdp 
test=$(setxkbmap -query | awk -F":" '/layout/ {print $2}') 
setxkbmap -layout $test
sudo xrdp-genkeymap km-0409.ini
echo "Please Restart the Computer"
echo "----------------------------"

Return to “Troubleshooting”

Who is online

Users browsing this forum: Markowitsch and 37 guests