分享

远程桌面连结linux(Xmanager)

 richsky 2012-08-27

首先有三个比较好的帖子

写道
运用Xmanager远程访问操作Linux系统是一个很不错的工具,具有图形化界面。在使用之前得配置linux,相关操作如下:

服务器:Red hat Enterprise Linux 5
终端:Xmanager 3.0

服务器配置:------------------------
1. 配置 XDM

(1). Change runlevel to 5
id:5:initdefault:
修改 /etc/inittab,将运行级别设置为5,即:
id:5:initdefault:

(2). Enable XDMCP

修改 /etc/gdm/custom.conf,

将 [xdmcp] 部分的 Enable 设置为 1,即:
[xdmcp]
Enable=1
Post=177
将 [security] 部分的 DisallowTCP 设置为 false,即:
[security]
DisallowTCP=false
2. 配置防火墙 (TCP/UDP Ports) / 若已经关闭防火墙,则忽略这一步
Open UDP port 177 from the PC to the remote host direction.
Open incoming TCP ports 6000~6010 from the remote host to your PC.
3. 重新启动服务器,即输入下面的命令即可:
# init 3; init 5
终端配置
------------------------
1、点击 Xmanager 图标,打开 Xbrowser
这时 Xbrowser 窗口中会显示局域网中所有的可用服务器

 

写道
. XDMCP connection fails for Linux. How do I configure my Linux box?

How to configure Linux XDMCP(KDE/GNOME) settings for Xmanager

Affected Files

For runlevel:
/etc/inittab

For GDM:
/etc/X11/gdm/gdm.conf

For KDM:
/etc/X11/xdm/xdm-config
/etc/X11/xdm/Xaccess
/etc/X11/xdm/kdmrc
/usr/share/kdm/kdmrc
/usr/share/config/kdm/kdmrc
/etc/opt/kde2/share/config/kdm/kdmrc

For Firewall:
/etc/sysconfig/ipchains


Step 1. Change runlevel to enable gdm or kdm.

1. Open /etc/inittab file.

2. Change the runlevel to 5 as following:

id:5:initdefault:

Step 2. GDM configuration (When the Linux is using gdm)

1. Open /etc/X11/gdm/gdm.conf file.

2. Go to the [xdmcp]section.

3. Set the value of "Enable" option to "1".

Step 3. KDM configuration (When the Linux is using kdm)

1. Open /etc/X11/xdm/xdm-config file.

2. Comment out "requestPort" option as following:
DisplayManager.requestPort: 0
==>
!DisplayManager.requestPort: 0

3. Open /etc/X11/xdm/Xaccess file.

4. Remove the initial "#" character for the following line:
#* #any host can get a login window
==>
* #any host can get a login window

5. Open /etc/X11/xdm/kdmrc,
/usr/share/config/kdm/kdmrc or
/etc/opt/kde2/share/config/kdm/kdmrc file.

6. Change the value of "Enable" option to "true".

Step 4. Firewall configuration (If the firewall has been configured)

1. Open /etc/sysconfig/iptables file.

2. Add the following lines at the top of the file:

-A input -p udp -s 0/0 -d 0/0 177 -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 telnet -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 ssh -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 login -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 exec -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 shell -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 7100 -j ACCEPT

Step 5. Restart your Linux to activate the changes.

此处是设置由于ip限制访问不了x的问题

Setup 3的第5和Setup 4的第二步都比较重要,一般教程上都没有提及,这里要特别关注。

此时已经可以连上X了



此时如果选择连接,会出现登陆窗口,然而输入登陆用户名密码后并不能进入linux的桌面,会报一个session错误,说打不开某个font文件,在此之前我在http://www./网上了xmanager的中文片字符安装文件并进行了安装chinese.exe,安装后我在xconfig中设置了半天的font,始终没有成功:



最后只好选择add font server,此时发现之前我打开过7100的端口,觉得应该能从服务器上下载中文字集。

不过始终无法连接到服务器。

我查看了一下/etc/sysconfig/iptables 的设置:

发现:

-A RH-Lokkit-0-50-INPUT -i lo -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 0:1023 --syn -j REJECT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 2049 --syn -j REJECT
-A RH-Lokkit-0-50-INPUT -p udp -m udp --dport 0:1023 -j REJECT
-A RH-Lokkit-0-50-INPUT -p udp -m udp --dport 2049 -j REJECT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 6000:6009 --syn -j REJECT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 7100 --syn -j REJECT
-A input -p udp -s 0/0 -d 0/0 177 -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 telnet -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 ssh -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 login -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 exec -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 shell -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 7100 -j ACCEPT

发现下面一句:

-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 7100 --syn -j REJECT
说明我的7100被禁了

将其用#注释掉

保存,再用xmanager连接,已经不报连接不上了,说明端口已经可以访问了。

然而还是进不了X,报一个.pinyi的font不能读取:



后来实在没办法,又到http://www./products/xmg_faq.html拜读了一下里面的说明,累死了~~全英文的:

突然我发现有这么一个介绍:

14. Gnome terminal fails to open in RedHat 7.3.
The problem occurs due to the font used by gnome-terminal.
To fix this problem, configure xfs program and add the specific font server into the font list of Xconfig.

Comment the following line out in the file /etc/X11/fs/config.
#no-listen = tcp

Restart xfs process or reboot the system.
Open Xconfig utility.
Choose Font tab.
Click Add Font Server button.
In the Host box, enter the hostname or IP address of Linux.
In the Port box, enter 7100.
Restart Xmanager.
Make sure that the font server should be listed in the bottom of the font list.



根据要求加上#号

重新启动xfs,在linux中输入:

$service xfs restart

通过xmanager2.0再次进入,发现漂亮的linux桌面

此处还有个小问题,由于之前我在root的环境变量文件.bash_profile中加了

export DISPLAY=192.168.1.XXX

因此进入xwindow中之前还会报个错,查看刚才那个文档有以下说明:

因此加#注释掉就行:

24. I entered correct username and password in the login screen but the remote desktop is still not displayed.
When the DISPLAY variable is manually assigned, the remote machine may not find X server (Xmanager). DISPLAY variable is set automatically by Xmanager so you do not need to manually assign it.
Please check your login script (.cshrc, .profile, .login, .bashrc, and etc) and comment out the line that starts with "export DISPLAY..." or "setenv DISPLAY..." as the following statements.


# export DISPLAY=192.168.1.XXX
# setenv DISPLAY 192.168.1.XXX




 

写道
http://hi.baidu.com/chenzhihan/blog/item/5335901222376fc3c3fd789a.html

这三个从第三个开始做起,第三个是图形化的方法,比较傻瓜些,如果没搞定,再看第一个和第二个,

其中下面的这个要尤其注意,我按三设好后,连不上,后发现是防火墙的问题,下面是具体操作 

 

 

 

Linux关闭防火墙命令

1) 永久性生效,重启后不会复原
开启:chkconfig iptables on
关闭:chkconfig iptables off

2) 即时生效,重启后复原
开启:service iptables start
关闭:service iptables stop

3)在开启了防火墙时,做如下设置,开启相关端口,
修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多