windows 远程ubuntu 16.04

XRDP – How To Remote Connect to Unity Desktop on Ubuntu 16.04

Hello World,

Today, we will show you how you can use the xRDP software package and make a remote desktop connection into the Unity Desktop Environment. Yes ! You read it correctly, with this procedure, you will be able to access your Unity Desktop through Remote Desktop ! No need to install alternate Desktop such as xfce, Mate, LXDE,….

You still do not believe it ! Have a quick look at our previous post, we have demonstrated that it was possible to connect to the Unity Desktop using the xRDP Software solution.    Today, we will provide you the recipe we have used in order to make it happening…

Tons of people have been asking us if this was possible..Some time ago, we provided a dirty workaround (see this post : XRDP – How to connect to console or how to connect to Unity Desktop). Today, we are providing not a workaround but a viable solution to have users connect to their Unity Desktop

Before you are getting too excited, you have to know that the solution do have some limitations but the solution seems to be workable.  We will try to provide some tips to overcome the limitation we have detected….

Disclaimer : 

We didn’t perform extensive testing yet so you might find out that something does not work as expected.  We will not be liable for any errors,omissions,problems,damages…arising from using this information. All the information is provided AS-IS. Use this procedure at your own risk !  

Bring xRDP & Unity to the next Level

Assumptions

When we have performed our installation & testing, we have been using the following infrastructure

  • We have performed a Fresh installation of the Ubuntu 16.04.1 LTS Released
  • We have performed the installation on a Virtual Machine running on Hyper-V Server and Virtualbox

We are assuming that

  • Your Ubuntu machine is connected to Internet (so you can download the necessary packages for the installation to occur). If you are not connected to internet, you can still manually download the necessary packages from this blog and copy them to your Ubuntu machine
  • You have your Ubuntu machine installed,configured and have the latest patches installed…
  • Your Ubuntu computer is running 16.04.1

Note : This process might be working with Ubuntu 14.04 and later but we did not test it…

Installation Process 

Step 1 – Download TigerVNC Server package

In this installation process, this is really the tricky part.  We need to install the tigervnc software solution but there is no Ubuntu packages available for Ubuntu 16.04.  If you look on the official TigerVNC repository, you will see that there is no deb packages for Ubuntu 16.04.

You will need to either compile Tigervnc package on your own or find an existing debian package that can be used with Ubuntu 16.04.

Our Tigervnc deb package available for download 

For your convenience, we are providing you a Tigervnc debian package that we have been using for our test.  You can try to use this package but we cannot guarantee that this package would work for you. We will also not provide any support if the package is not working for you.  You can give it a try and see if it works….(use it at you own risk !)

Box-download-48Download Tigervnc Deb Package (for Ubuntu 16.04.1 – 64 bit)

Step 2 – Install the TigerVNC Server package

1 –  Open a Terminal console and move to your Download folders (or location where you have saved the packaged downloaded above)

cd Downloads

uXrdp_Install_2

Click on picture for better Resolution

2 – In the terminal console, type the following

sudo dpkg -i tigervncserver_1.6.80-4_amd64.deb

You might see some warning and errors messages. Ignore these messages for the moment…

uXrdp_Install_4

Click on picture for better Resolution

3 – To ensure that all the dependencies are installed, issue the following command in the Terminal console

sudo apt-get install -f

uXrdp_Install_5

Click on picture for better Resolution

Step 3 -Install the xrdp package

1 –  Open a Terminal console and issue the following command

sudo apt-get install xrdp -y

You might be asked to provide a password (because you are using sudo command)

uXrdp_Install_7

Click on picture for better Resolution

Step 5 – Configure the xrdp settings 

You need to specify which desktop to start while connected through xRDP session.  To perform this action, you would need to create and populate either the .xsession file (per user) or the /etc/startwm.sh (all users) with the proper configuration information (as described below)

1 –  Open a Terminal console and issue the following command (if you have only one user on your system)

echo unity>~/.xsession

or

sudo sed -i.bak '/fi/a #xrdp multi-users \n unity \n' /etc/xrdp/startwm.sh

Step 6 – Configure the xrdp keyboard Settings 

Note :  You need to perform this action on the local Ubuntu machine (and not through the xrdp connection !!)

By default, the xRDP login screen will use an en-us keyboard layout. You remote session will also be using the en-us keyboard layout.  If you are using a different keyboard layout than the english one, you need to perform the following actions in order to update the configuration of the xrdp software.

In my case, I’m using a Belgian French keyboard, so I had to tell xrdp to use the belgian french keyboard as well.  To do that, you need to perform the following actions :

1 : You go to the /etc/xrdp directory

2 : you issue the command setxkbmap -layout <%your layout%> to define which keyboard map/layout to use

XRDP_15.04_5.PNG

Click on Picutre for better Resolution 

3 : create a copy of the km-0409.ini file into the same directory. It seems that this is the default file used by xrdp to define the keyboard layout. You will need to use sudo in order to be able to write into the directory

4 : Check that you have a backup of your file by typing the dir or ls command

5 : update the file by issuing the following command sudo xrdp-genkeymap km-0409.ini

XRDP_15.04_6.PNG

Click on Picutre for better Resolution 

You can achieve the same results using the following command line script. In your terminal console; simply copy/paste this text and it will try to find out automatically your keyboard layout

# Set keyboard layout in xrdp sessions 
cd /etc/xrdp 
test=$(setxkbmap -query | awk -F":" '/layout/ {print $2}') 
echo "your current keyboard layout is.." $test
setxkbmap -layout $test 
sudo cp /etc/xrdp/km-0409.ini /etc/xrdp/km-0409.ini.bak 
sudo xrdp-genkeymap km-0409.ini

Step 7 – Reconnect to the Same Session

Since Ubuntu 14.10, a new xrdp package has been made available in the Ubuntu repository. This package fixes a long time issue related to the fact that users could not reconnect to the same session.  If you are using the package xrdp 0.6.1-1 or later, you do not need to perform any customization, you will reconnect automatically to the same session.

Test your Setup & Connect to Unity 

To test your configuration, simply start your remote desktop client from a Windows machine, type in the hostname or ip address of the Ubuntu computer to connect to and try to connect.  If everything is working as expected, you should see first the xrdp login box

uXrdp_Install_11

Click on picture for better Resolution

And then after providing the credentials, you should see your Unity Desktop inside the xRDP Session….. (isn’t it cool :-))

Unity_XRDP_16.04.1

Click on picture for better Resolution

Detected Issues (so far…)

Missing Mouse cursor 

The first time you connect to Unity through xRDP, you might see that the mouse cursor is not visible or missing. The workaround is to right-click on the desktop and click on open Terminal option. As soon as you perform this action, you will see the big cross mouse cursor

Missing indicator panel 

If you look on the right top of your desktop while connected through xRDP, you will notice that there is no indicator icons over there.  At the moment, we didn’t find a way to bring this one back in the xRDP Session.

To fix this issue, you have to modify your .xsession file. the .xsession file should look like the following

Credits for the code below :

/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &
/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &
/usr/lib/unity-settings-daemon/unity-settings-daemon &

for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; 
do
  basename=`basename ${indicator}`
  dirname=`dirname ${indicator}`
  service=${dirname}/${basename}/${basename}-service
  ${service} &
done

unity

Logout option not available or not working 

Because the indicator is not available, you cannot select the logout option.  In Ubuntu 16.04, via the Dash, you can look for the logout icon. If you click on it, you will not be logged out.  If you try the command line, issuing the gnome-session-quit –logout, this will not working either.

Workaround :

you either disconnect from the xrdp session and your session will be still running on the ubuntu machine.  You can try to use the command line pkill -u <your user name>. This will kill the xRDP Session but will also kill you connection on the ubuntu machine if you were locally logged on.

You could also use the following command line.  This should kill your xrdp session only

ps -ef h | grep Xvnc | grep `whoami` | tr -s " " | cut -d " " -f2 | xargs kill -9

Performance Issues

Some people complains that the performance were not that great. So far we didn’t investigate this. As more people would use the Unity Desktop, you might be able to have some hints and see where the performance lies…

Final Notes 

Voila ! We did it ! At this stage, you should be able to access your Unity Desktop through xRDP package.  You can now perform a remote desktop connection to your Ubuntu computer and enjoy the same interface as the one you are using when logged on locally on the system.

To achieve this results, the only thing that needed is to replace the aging vnc server software (vnc4server,x11vnc,…) with a more recent vnc server solution.  By simply changing the backend vnc server component of the xRDP solution, it is now possible to connect to your Unity Desktop….(This is so cool….:-) )

I hope that you will enjoy your new remote experience and you will provide us some feedback about this totally new experience…

Till next time

See ya

Posted in XRDP Tagged Remote Desktoptigervncubuntu 16.04UnityUnity 7Unity DesktopXRDP

Post navigation

66 thoughts on “XRDP – How To Remote Connect to Unity Desktop on Ubuntu 16.04


http://c-nergy.be/blog/?p=9962

Comment navigation


猜你喜欢

转载自blog.csdn.net/huohongpeng/article/details/78484614