在Centos中设定tigervnc,Windows远程桌面centos
1.查看是否有安装tigervnc
#rpm -qa |grep vnc
tigervnc-server-1.1.0-5.e16_4.1.x86_64
tigervnc-1.1.0-5.e16_4.1.x86_64
2.如果没有,则按如下命令安装
#yum install tigervnc tigervnc-server
3.修改VNC的读取文件
# vi /etc/sysconfig/vncservers
再最后面加入如下两行:
VNCSERVERS="1:root 2:brian"
VNCSERVERARGS[1]="-geometry 800x600 -query localhost"
VNCSERVERARGS[2]="-geometry 1024x768 -query localhost"
附:
1、这里的“用户名”是指linux系统用户的名称;
2、上面第一行是设定可以使用VNC服务器的帐号,可以设定多个,但中间要用空格隔开。注意前面的数字“1”或是“2”,当你要从其它电脑来VNC服务器时,就需要用IP:1这种方法,而不能直接用IP。如假定你的VNC服务器IP是192.168.1.100,那想进入VNC服务器,并以brian用户登录时,需要在vncviewer里输入IP的地方输入:192.168.1.100:2(192.168.1.100:5902),如果是root,那就是192.168.1.100:1(192.168.1.100:5901);
4.设定密码
#vncpasswd //设置vnc访问密码,这里是为root远程用户配密码,所以在root账户下配;依次类推,为别的账户配密码,就要在别的账户下设密码。
5.启动 VNC Server 服务
#service vncserver stop //以管理员身份登录,先停止服务
#service vncserver start //启动服务
6.在防火墙上打开 VNC Server 的监听端口,VNC Server 用到了三个端口:5801、5901、6001
#vi /etc/sysconfig/iptables
添加下面三行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5801 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6001 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited //注意,前面三句一定要在此语句的前面,否则不会生效
#/etc/rc.d/init.d/iptables restart //重新启动防火墙
#netstat -tpln | grep "5900" //端口是否有开放
#vncserver -list //列出当前用户建立的所有远程桌面
1.查看是否有安装tigervnc
#rpm -qa |grep vnc
tigervnc-server-1.1.0-5.e16_4.1.x86_64
tigervnc-1.1.0-5.e16_4.1.x86_64
2.如果没有,则按如下命令安装
#yum install tigervnc tigervnc-server
3.修改VNC的读取文件
# vi /etc/sysconfig/vncservers
再最后面加入如下两行:
VNCSERVERS="1:root 2:brian"
VNCSERVERARGS[1]="-geometry 800x600 -query localhost"
VNCSERVERARGS[2]="-geometry 1024x768 -query localhost"
附:
1、这里的“用户名”是指linux系统用户的名称;
2、上面第一行是设定可以使用VNC服务器的帐号,可以设定多个,但中间要用空格隔开。注意前面的数字“1”或是“2”,当你要从其它电脑来VNC服务器时,就需要用IP:1这种方法,而不能直接用IP。如假定你的VNC服务器IP是192.168.1.100,那想进入VNC服务器,并以brian用户登录时,需要在vncviewer里输入IP的地方输入:192.168.1.100:2(192.168.1.100:5902),如果是root,那就是192.168.1.100:1(192.168.1.100:5901);
4.设定密码
#vncpasswd //设置vnc访问密码,这里是为root远程用户配密码,所以在root账户下配;依次类推,为别的账户配密码,就要在别的账户下设密码。
5.启动 VNC Server 服务
#service vncserver stop //以管理员身份登录,先停止服务
#service vncserver start //启动服务
6.在防火墙上打开 VNC Server 的监听端口,VNC Server 用到了三个端口:5801、5901、6001
#vi /etc/sysconfig/iptables
添加下面三行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5801 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6001 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited //注意,前面三句一定要在此语句的前面,否则不会生效
#/etc/rc.d/init.d/iptables restart //重新启动防火墙
#netstat -tpln | grep "5900" //端口是否有开放
7.Windows远程连接用 VNC Viewer、winvnc Vncviewer等软件,VNC的默认端口是5900,而远程桌面连接端口则是5900+n,如:10.0.10.208:1 或者 10.0.10.208:5091
附:
#vncviewer localhost:n //n对应vncserver指定的数字#vncserver -list //列出当前用户建立的所有远程桌面