Thursday, March 24, 2011

Remote access using VNC

Install the vncserver
    yum install tigervnc-server

Configure the port number and resolution by editing /etc/sysconfig/vncservers

VNCSERVERS="1:chris 2:kurdt"
VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp"

We have two vnc client user 1:chris and 2:kurdt. we need to open the port in iptables

chris port
iptables -A custom-fw-input -p tcp -m state --state NEW -m tcp --dport 5901 -j ACCEPT

kurdt port
iptables -A custom-fw-input -p tcp -m state --state NEW -m tcp --dport 5902 -j ACCEPT
or you can use port range in iptables
iptables -A INPUT -m tcp -p tcp --dport 5901:5902 -j ACCEPT

Configure the environment and password by login to the user account.
[root@rhel01 ~]# su - chris
[chris@rhel01 ~]$ vncserver

You will require a password to access your desktops.

Password:
Verify:

New 'rhel01.localdomain:1 (chris)' desktop is rhel01.localdomain:1

Creating default startup script /home/chris/.vnc/xstartup
Starting applications specified in /home/chris/.vnc/xstartup
Log file is /home/chris/.vnc/rhel01.localdomain:1.log

[chris@rhel01 ~]$
Notice that it will create /home/chris/.vnc folder. Same process should also be done to user "kurdt"

Start the vncserver daemon
[root@rhel01 ~]# service vncserver start

Install tightvnc for windows and use VNC server :5901


You will be prompted for a password. Use the password that was configured to access your desktop

or use the linux client for vnc
vncviewer <vncservername>:1

if everthing goes well, remember to save your iptables config by issuing the command
service iptables save

No comments:

Post a Comment