Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
2:etl
New 'localhost.localdomain:2 (etl)' desktop is localhost.localdomain:2
Starting applications specified in /home/etl/.vnc/xstartup
Log file is /home/etl/.vnc/localhost.localdomain:2.log
[ OK ]
6、配置防火墙
如果你不配置防火墙,此时用VNC Viewer连接的话,一般会报:"connect:Connection timed out(10060)"错误,如下所示:


一般这种情况要么关闭防火墙,要么需要配置防火墙。
[root@localhost ~]# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
关闭防火墙后,用VNCView连接服务器没有问题,但是一般不建议关闭防火墙,
[root@localhost ~]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_ns [ OK ]
[root@localhost ~]# iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p tcp --dport 5902 -j ACCEPT

OK,可以通过VNC连接到服务器了
关于VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下
桌面号为“1” ---- 端口号为5901
桌面号为“2” ---- 端口号为5902
桌面号为“3” ---- 端口号为5903
……
基于Java的VNC客户程序Web服务TCP端口从5800开始,也是与桌面号相关,对应关系如下
桌面号为“1” ---- 端口号为5801
桌面号为“2” ---- 端口号为5802
桌面号为“3” ---- 端口号为5803
基于上面的介绍,如果Linux开启了防火墙功能,就需要手工开启相应的端口,以开启桌面号为“1”相应的端口为例,命令如下
开机自启动vncserver服务
# chkconfig vncserver on
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/shumachanpin/article-43005-4.html
10万元存银行一年缩水100元
一个生病孩子急需大家的帮助