现在的位置: 首页 > 综合 > 正文

Windows远程桌面(mstsc)通过RDP协议访问Ubuntu

2014年07月05日 ⁄ 综合 ⁄ 共 3315字 ⁄ 字号 评论关闭

1. 安装xrdp

zhou@desktop:~$ sudo apt-get install xrdp

[sudo] password for zhou:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  vnc4server xbase-clients
建议安装的软件包:
  vnc-java
下列【新】软件包将被安装:
  vnc4server xbase-clients xrdp
升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 2,412 kB 的软件包。
解压缩后会消耗掉 7,086 kB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main xbase-clients all 1:7.6+12ubuntu2 [2,322 B]
获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/universe vnc4server amd64 4.1.1+xorg4.3.0-37ubuntu4 [2,143 kB]
获取:3 http://cn.archive.ubuntu.com/ubuntu/ precise/universe xrdp amd64 0.5.0-2 [267 kB]
下载 2,412 kB,耗时 4秒 (492 kB/s)
Selecting previously unselected package xbase-clients.
(正在读取数据库 ... 系统当前共安装有 194579 个文件和目录。)
正在解压缩 xbase-clients (从 .../xbase-clients_1%3a7.6+12ubuntu2_all.deb) ...
Selecting previously unselected package vnc4server.
正在解压缩 vnc4server (从 .../vnc4server_4.1.1+xorg4.3.0-37ubuntu4_amd64.deb) ...
Selecting previously unselected package xrdp.
正在解压缩 xrdp (从 .../xrdp_0.5.0-2_amd64.deb) ...
正在处理用于 man-db 的触发器...
正在处理用于 ureadahead 的触发器...
ureadahead will be reprofiled on next reboot
正在设置 xbase-clients (1:7.6+12ubuntu2) ...
正在设置 vnc4server (4.1.1+xorg4.3.0-37ubuntu4) ...
update-alternatives: 使用 /usr/bin/vnc4server 来提供 /usr/bin/vncserver (vncserver),于 自动模式 中。
update-alternatives: 使用 /usr/bin/Xvnc4 来提供 /usr/bin/Xvnc (Xvnc),于 自动模式 中。
update-alternatives: 使用 /usr/bin/x0vnc4server 来提供 /usr/bin/x0vncserver (x0vncserver),于 自动模式 中。
update-alternatives: 使用 /usr/bin/vnc4passwd 来提供 /usr/bin/vncpasswd (vncpasswd),于 自动模式 中。
update-alternatives: 使用 /usr/bin/vnc4config 来提供 /usr/bin/vncconfig (vncconfig),于 自动模式 中。
正在设置 xrdp (0.5.0-2) ...
 * Generating xrdp RSA keys......                                               
Generating 512 bit rsa key...

ssl_gen_key_xrdp1 ok

saving to /etc/xrdp/rsakeys.ini

                                                                         [ OK ]

 * Starting Remote Desktop Protocol server                               [ OK ]

2、配置xrdp

目的是让xrdp传输远程服务的2D桌面,默认传输的是3D桌面,可能会有问题。

zhou@desktop:~$ sudo vim /etc/xrdp/startwm.sh
#!/bin/sh

if [ -r /etc/default/locale ]; then
  . /etc/default/locale
  export LANG LANGUAGE
fi
echo "gnome-session --session=ubuntu-2d">.xsession         
#新添加行

. /etc/X11/Xsession

3、配置lightdm

这里需要配置XDMP服务器

zhou@desktop:~$ sudo vim /etc/lightdm/lightdm.conf

[SeatDefaults]

greeter-session=unity-greeter

user-session=ubuntu

#以下为新加行

greeter-show-manual-login=true       
#指允许通过键入用户名和密码的方式来登录系统

[XDMCPServer]                                   
#字段指启动XDMCP服务器


enabled=true

4. 重启xrdp 和lightdm

zhou@desktop:~$ sudo /etc/init.d/xrdp rstart

Usage: /etc/init.d/xrdp {start|stop|restart|force-reload|status}
zhou@desktop:~$ sudo /etc/init.d/xrdp restart
 * Stopping RDP Session manager                                          [ OK ]
 * Starting Remote Desktop Protocol server                               [ OK ]
zhou@desktop:~$ /etc/init.d/lightdm restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service lightdm restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop lightdm ; start lightdm. The restart(8) utility is also available.
stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.119" (uid=1000 pid=4742 comm="stop lightdm ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1
comm="/sbin/init")

5. 现在可以通过windows的mstsc远程登录

原文地址:http://wangxiaoyu.blog.51cto.com/922065/1294098

抱歉!评论已关闭.