原文链接:http://www.humans-enabled.com/2013/02/how-to-install-xrdp-on-ubuntu-1204.html
I absolutely love a system that can stay connected! With Ubuntu GNU/Linux, there are many ways to get connected remotely to your computer and get your Linux on!
For instance, here is a list of several ways you can stay connected:
Desktop Sharing (built-in VNC, see help)
SSH (requires install)
FreeNX ( requires install
)
NX Free (requires install)
ssh -X (requires install and local xserver)
The default "Desktop Sharing" functionality in Ubuntu 12.04 is good for some things, but since it's based on VNC, and doesn't have any additional layer for security, it's not a necessarily secure method for connecting to remote machines. Also, people trying to connect from their windows systems will have to obtain/install a vnc client to use for connection. This can be a problem in some environments.
This is where xrdp comes in. xrdp.org is free open source software that can be easily installed in Ubuntu 12.04 GNU/Linux machine via the package management system. Since it uses the RDP protocol, xrdp is a relatively secure method of connection. Other benefits are that your windows users can easily connect with their built-in remote desktop client mstsc.exe and your Linux users with rdesktop.
In this post I'm going to outline how to quickly install the xrdp packages and connect with mstsc.exe(windows) or rdesktop(GNU/Linux.
cankykong1备注:如果你的是ubuntu server,还没有安装桌面系统,要先执行
sudo apt-get install ubuntu-desktop
安装桌面
1.) Enable the community repository in Ubuntu - click to open the "Ubuntu Software Center". Then, on the top menu(top of screen), click Edit > Software Sources > put a checkmark by "Community-maintained free and open-source software (universe)", then click Close.
cankykong1备注: 这步可以省略,我从来没执行过也没有遇到过问题
2.) Update your sources and install xrdp using apt-get. Open the terminal with ctrl+alt+t, then type or paste these commands, hit enter, authenticate, then confirm to install the xrdp packages.
sudo apt-get update && sudo apt-get install xrdp
Note: Depending on how quickly your machine can update the sources, the sudo apt-get update command may fail after closing the Ubuntu Software Manager because there may be a process running that is updating the sources already in the background. If this happens, wait longer, then try the command again.
3.) Add this special .xsession file entry into the /home/(username) directory you intend to login with (e.g., /home/shannon/.xsession) to improve performance by converting your session to ubuntu-2d:
echo "gnome-session --session=ubuntu-2d" > /home/YOURUSER/.xsession
cankykong1备注:也可以在xrdp的配置文件中写:
echo "gnome-session --session=ubuntu-2d" > .xsession
将上面的一句话放在 /etc/xrdp/startwm.sh 这个脚本里面调用
. /etc/X11/Xsession 之前
4.) Reload the configuration into the xrdp server process:
sudo /etc/init.d/xrdp restart
cankykong1备注:建议用service来管理服务 : sudo service xrdp restart
That's it. Now you can connect to your xrdp host with ease from GNU/Linux using:
rdesktop ip-or-host-of-your-xrdp-server
cankykong1备注:用你的windows连上去试试吧
Or from windows, with:
windows-key+R, mstsc.exe /v:ip-or-host-of-your-xrdp-server
Tip: If you find that you're having problems changing network settings via your xrdp session, it's because of the protection configured to secure the machine to console users only via policy-kit.
See this article for more information and a workaround:
http://ubuntuforums.org/showpost.php?s=d9ba0898e67cf91204ecc75f693ed4ed&p=10095159&postcount=3
Spoiler: Basically you're modifying all "no" values in the allow_inactive attributes to "yes" in
/usr/share/polkit-1/actions/org.freedesktop.network-manager-settings.system.policy
Cheers!
Shannon VanWagner
02-03-2013