Xmanager访问CentOS相关配置
一.配置gdm [root@aca80120 ~]# cd /etc/gdm/ [root@aca80120 gdm]# ls custom.conf gdm.schemas PostLogin PreSession gdm.conf Init PostSession Xsession [root@aca80120 gdm]# vi custom.conf 如果不存在该目录,则需要先安装gdm yum -y install gdm 在/etc/gdm/custom.conf文件中相应部分添加以下红色部分内容: # GDM configuration storage [daemon] [security] DisallowTCP=false AllRoot=true AllRemoteRoot=true [xdmcp] Enable=true Port=177 [greeter] [chooser] [debug] 将该文件拷贝成gdm.conf文件 cp custom.conf gdm.conf
二.防火墙设置
按照以上配置gdm使用的端口是177,需将防火墙中加入对这个端口的允许访问。编辑文件: vi /etc/sysconfig/iptables # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited A INPUT -m state --state NEW -m tcp -p tcp --dport 6000:6010 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 177 -j ACCEPT COMMIT 配置完成后重启防火墙 service iptables restart 或者关闭防火墙 service iptables stop
三.X11的配置
在CentOS6.3环境下,经测试本步骤不需要修改也可正常访问
[root@aca80120 gdm]# cd /etc/X11/xdm/ [root@aca80120 xdm]# ls 11 TakeConsole xdm-config Xresources Xsession Xstartup GiveConsole Xaccess Xreset Xservers Xsetup_0 Xwilling [root@aca80120 xdm]# vi Xaccess # # The first form tells xdm which displays to respond to itself. # The second form tells xdm to forward indirect queries from hosts matching # the specified pattern to the indicated list of hosts. # The third form tells xdm to handle indirect queries using the chooser; # the chooser is directed to send its own queries out via the broadcast # address and display the results on the terminal. # The fourth form is similar to the third, except instead of using the # broadcast address, it sends DirectQuerys to each of the hosts in the list # The fifth form tells xdm which addresses to listen for incoming connections # on. If present, xdm will only listen for connections on the specified # interfaces and/or multicast groups. # # In all cases, xdm uses the first entry which matches the terminal; # for IndirectQuery messages only entries with right hand sides can # match, for Direct and Broadcast Query messages, only entries without # right hand sides can match. # #将以下行前的注释#去掉 #* #any host can get a login window # # To hardwire a specific terminal to a specific host, you can # leave the terminal sending indirect queries to this host, and # use an entry of the form: # #terminal-a host-a 四.系统以图形化模式启动
修改/etc/inittab文件,以使系统以图形化界面启动系统。
# For information on how to write upstart event handlers, or how # upstart works, see init(5), init(8), and initctl(8). # # Default runlevel. The runlevels used are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault: 并在文件尾加上 x:5:respawn:/usr/sbin/gdm
五.重启系统
六.测试Xmanager访问
1.启动Xbrowser新建一个session,填入Host的ip地址,如下图所示:
端口使用默认的177端口即可。确定退出后双击刚新建的session就可打开的连接。
2.使用SecureCRT打开图形应用
A.启动Xmanager - Passive B.查看本机ip地址
C.使用SecureCRT连接上系统执行以下命令 [root@aca80120 ~]# export DISPLAY=172.168.1.181:0.0 D.在本地打开远程的xclock [root@aca80120 ~]# xclock