使用Xmanager2.0远程访问linux9方法。
此方法网络上面有相关描述,在此我做些补充:
2. 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.netsarang.com/网上了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.netsarang.com/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中之前还会报个错,查看刚才那个文档有以下说明:
因此加#注释掉就行:
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
--------------------------------
其他帖子:
检查:
service iptables stop
然后
netstat -an|grep 177
netstat -an|grep 7100
netstat -an|grep 21
-----------------
在 /etc/hosts 里面增加我的ip地址和主机名
xmanger可以登陆成功。
本文转自斯克迪亚博客园博客,原文链接:http://www.cnblogs.com/sgsoft/archive/2007/05/17/750607.html,如需转载请自行联系原作者