ShakeProof

「2013-1-24」XDMCP Configuration for Remote Access to Linux Desktop

接着上上篇博客里的最后一项,大致记录一下 XDMCP 的一些内容。末尾会附带提一下 VNC(Virtual Network Computing)。

首先上张图:

image

对于 X Window System paradigm 而言,这里的 server 并不是传统意义上的服务器(central server),其含义可在 wikipedia 上找到(可见其更像一个 telnet client,但由于其负责 X client 的显示,故称之为 X server):

A display manager can run on the same computer where the user sits or on a remote one. In the first case, the display manager starts one or more X servers, displaying the login screen at the beginning and (optionally) every time the user logs out. In the second case, the display manager works according to the XDMCP protocol.

The XDMCP protocol mandates that the X server starts autonomously and connects to the display manager. In the X Window System paradigm, the server runs on the computer providing the display and input devices. A server can connect, using the XDMCP protocol, to a display manager running on another computer, requesting it to start the session. In this case, the X server acts as a graphical telnet client while the display manager acts like a telnet server: users start programs from the computer running the display manager, while their input and output take place on the computer where the server (and the user) sits.

XDMCP 协议在 X11R4 中引入,用于解决 X11R3 实现中的问题。其基本阐述(the interactive process between X server and X Display Manager),可点此链接

顺便了解了一下这方面的历史,挺有趣的,而且还能够帮助理解 XDMCP,便于机房调试期间的 troubleshooting……

XDM 最初是为了支持 X Terminal(上世纪 90 年代因其能够提供比 Unix 工作站更低廉的价格,而受到一定程度的欢迎):

XDM (in full, the X Window Display Manager) is the default display manager for the X Window System. It is a bare-bones X display manager. It was introduced with X11 Release 3 in October 1988, to support the standalone X terminals that were just coming onto the market. It was written by Keith Packard.

X Terminal 的历史,也是一种「老一代产品」的发展史,和 Palm 有点像(不忍心直接提黑莓)。后来随着「瘦客户端」(Thin Client,比如 VNC 就是一种瘦客户端协议)逐渐受到欢迎,加上各种 X server 实现,使得购买一台 PC 即可拥有 X Terminal 的功能,渐渐地,它就退出了历史舞台,难觅踪迹。

image

顺便挖个坑,待填。《X Window System (X11) protocols and architecture》,讲述其设计框架,尤其是为何能够做到 network-transparent。

在 CentOS 5.5 x86_64 上配置 XDMCP 的方法可参考如下链接:《GDM and XDMCP configuration for remote graphical Linux desktop access》,需要注意的是,在 CentOS 5.5 或更高的版本上,XDM 已经不被支持,取而代之的是 GDM(Gnome Display Manager),因此要关注「GDM login manager」的部分,而不是「XDM login manager」。还有一个中文的图文版,不全面,比较简单,仅供参考。

运行「sudo gdmsetup」可以使用图形化界面的方式,来配置 GDM,如下所示:

image

「Maximum remote sessions」可以修改成更大的数值(如 30 或者 60),如果有较多 remote clients 需要登录的话。「Maximum pending request」也可以修改成更大的数值。

各个参数的含义,参考文件 /usr/share/gdm/defaults.conf 里的注释;上述 GUI 里所做的修改,会写入文件 /etc/gdm/custom.conf。当然也可直接编辑 custom.conf 文件,相对重要的几个参数可修改如下:

[security]
DisallowTCP=false

[xdmcp]
Enable=true
MaxPending=30
MaxWait=20
MaxSessions=60

完成配置后,重启 X Window System:

$ su -
$ init 3
$ init 5

通过各种 X server 实现,即可通过 XDMCP 协议完成从客户机到服务器的远程连接了。从 Windows 上连接到 Linux 可以使用 XManager,或者其他的开源实现比如 XmingCygwin X(但仅仅为了 remote control 就单独安装 Cygwin,似乎小题大做了一点…… 囧);Linux 上则有 Xnest。我们这里采用的是 XManager。

通过 XManager 连接时,必须保证如下几点配置(理解了上文的原理,这些配置就理所当然了):

  1. 采用 XDM Query 方式。
    image
  2. Display Number 必须是「自动分配」。

    image

类似的,上文提到的 Linux 下的 Xnest,其远程连接的命令如下,也是 query 方式,同时手动指定 Display number 是「10」(确保不和其他人冲突,否则登陆不成功):

Xnest :10 -query other_computer_name

更多的 GDM 配置,可以参考这个链接(Gnome 官方指南)。

P.S.

对于 Linux 防火墙的配置问题,个人推荐是,如果并非针对外网的服务器,最好直接将其关闭,省的配置一堆端口,比较麻烦;而且根据这几天的经验,指不定就因为防火墙没配置好,出各种问题…… 囧
挖坑待填吧,《IP 信息包过滤系统,netfilter/iptables》

另外,VNC(虚拟网络计算)是基于 RFB 协议(Remote FrameBuffer):

Although RFB started as a relatively simple protocol it has been enhanced with additional features (such as file transfers) and more sophisticated compression and security techniques as it has developed. To maintain seamless cross-compatibility between the many different VNC client and server implementations, the clients and servers negotiate a connection using the best RFB version, and the most appropriate compression and security options, that they can both support.

CentOS wiki 上有专门的 VNC 页面(),Fedora 也有相应的页面。VNC 同 XDMCP 的最根本不同之处,就在于其 X server 是运行在服务器端,而不是 remote user 端;remote user 端仅仅负责显示一份 framebuffer 的拷贝(对客户端硬件要求很低,故称为「瘦客户端」thin client)。

IBM developerworks 上有一个讲述如何将 VNC 和 XDMCP 结合起来的文章,只读了第一部分,了解了「为何想要把两者结合起来」,如下:

The downside to VNC is that RFB authentication is based on passwords without user names. Thus, each user must launch an independent VNC server session and connect to that VNC instance by specifying the correct port number. This requirement might be tolerable on a single-user system, but is extremely awkward on a multiuser computer.

其他以后有时间再看吧。由于此链接将问题描述的十分清晰(包括 XDMCP 和 VNC 的各自局限性等等),故直接将链接摆出来,供参考:
http://www.ibm.com/developerworks/opensource/library/os-multiuserloginsvnc/index.html

posted on 2013-01-24 17:18  mirrorwheel  阅读(448)  评论(1编辑  收藏  举报

导航