2015年4月3日星期五

Centos Secure Remote Desktop Setting

Install Desktop & VNC Server

# yum -y groupinstall Desktop 

# yum -y install tigervnc-server

Log in to your Centos server (via SSH) as the user you want to use to access VNC.

# cd ~/ 

# vncpasswd 

setup the VNC Connection Password. It is different from the user password.

Edit /etc/sysconfig/vncservers

# vi /etc/sysconfig/vncservers

Edit or Add this two lines

VNCSERVERS="2:yourvncuser" 
VNCSERVERARGS[2]="-geometry 1024x768 -localhost"


    2 — This indicates the port used for the VNC connection. Only the last digit is entered. For example, 1 defines port 5901. 9 indicates use of port 5909.

    1024x768 — This sets the size that VNC renders your desktop. You can change it as you need.


    -localhost — This option limits VNC to allow only local connections. This setting makes the VNC connection more secure when used in conjunction with an SSH tunnel. 


Start the VNC Server Service

# service vncserver start 

# chkconfig vncserver on 


Use SSH to establish a secure tunnel:

Open PuTTY, select the saved session, and then click Load.

In the Category , from Connection click SSH, and then Tunnels. 



Type and enter the following, and click Add:

    Source port — Type 590, plus the port you specified in the VNC configuration file. Because we used port 2 in that example, then we enter 5902.

    Destination — Type localhost:590, plus the port you specified in the VNC configuration file. Because we used port 2 in this example, we would enter 5902.

In the Category section, go to Session.

In the Saved Sessions field, type VNC Tunnel(or your server vnc tunnel as you like), and then click Save.


Use VNC Client to connect the server.

  • Open the PuTTY, select the Centos Server saved session, click Load, and then log in to your server. This opens the SSH Tunnel that you configured before.
  • Open your preferred VNC Client, type localhost:590[n] (where [n] is the port you specified in the VNC configuration file, and then press Enter. In this case is localhost:5902


  • Then it will ask your vnc connection password. After you key in the correct password then you can see this similar screen.


    That's All. Enjoy!

    沒有留言: