[iyunv@cent2 ~]# cat /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
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
大家看到了没有,这里连接的就是本地的127.0.0.1:5901了。 2.2 liunx客户端 利用ssh 映射服务端(192.168.1.102)的5901端口 到 本地的5901端口
[iyunv@cent1 Desktop]# ssh -L 5901:localhost:5901 192.168.1.102
The authenticity of host '192.168.1.102 (192.168.1.102)' can't be established.
RSA key fingerprint is ea:d9:cd:1e:5a:51:79:07:19:d2:e3:50:99:3f:35:a6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.102' (RSA) to the list of known hosts.
Address 192.168.1.102 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! root@192.168.1.102's password:
Last login: Sun Sep 7 18:55:25 2014 from 192.168.1.101
[iyunv@cent2 ~]#
开启vncviewer
root@cent1 Desktop]# vncviewer 127.0.0.1:5901
TigerVNC Viewer for X version 1.1.0 - built Feb 4 2014 05:24:41
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Sun Sep 7 11:24:11 2014
CConn: connected to host 127.0.0.1 port 5901
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
Sun Sep 7 11:24:17 2014
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using Tight encoding
这样就配置好了,可以在liunx里面登陆了。