vnc使用

使用rpm –qa vnc命令如果收到如下信息说明已经安装了vncserver,
[root@localhost: ~]#rpm -qa |grep vnc
gtk-vnc-python-0.3.2-3.el5
vnc-server-4.1.2-14.el5
gtk-vnc-0.3.2-3.el5
vnc-4.1.2-14.el5

服务器安装:sudo yum install vnc-server

服务器端配置如下:

用ip加端口号 ip:1,ip:2,ip:3 来标识。vncserver的大部分配置文件及日志文件都在用户home目录下.vnc目录下
用户可以自定义启动号码如:
[huilin@localhost /]$ vncserver :2
A VNC server is already running as :2
[root@localhost: ~]#vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
# Uncomment the lines below to start a VNC server on display :2
……
VNCSERVERS
="1:root 2:demo" #此处添加用户 VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" #vncserver -geometry 800x600 设置vncserver的分辨率

修改密码:运行vncpasswd即可

停止vncserver:#vncserver -kill :1

启动vnc-server:$ sudo chkconfig vncserver on

开启响应端口:
   $ sudo netstat -ntlp           #找出相对应的端口,笔者这里为5901
   $ sudo vim /etc/sysconfig/iptables     #开启端口 添加  -A INPUT -s 111.13.4.0/255.255.255.0 -p tcp -j ACCEPT
   $ sudo /etc/init.d/iptables restart

登陆:
   客户端输入:172.17.13.65:1

注意防火墙要关闭:否则无法访问

查看iptables状态:

service iptables status

iptables开机自动启动: 

开启: chkconfig iptables on
关闭: chkconfig iptables off

iptables关闭服务:

开启: service iptables start
关闭: service iptables stop

原文地址:https://www.cnblogs.com/dorothychai/p/3223905.html