12.2 C
Vancouver
Monday, October 7, 2024

Setting up VNCServer

Must read

How to setup vncserver on a linux machine to run gnome or kde.

Initialize

Startup vncserver for the first time on port 5910 (:10) and set the password.

[root@localhost ~]# vncserver :10

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /root/.Xauthority

New 'localhost.localdomain:10 (root)' desktop is localhost.localdomain:10

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:10.log

[root@localhost ~]#

Configure

Edit ~/.vnc/xstartup and change the session manager to

  • gnome-session – for Gnome
  • startkde – for KDE
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

Restart vncserver

[root@localhost .vnc]# vncserver -kill :10
Killing Xvnc process ID 2844
[root@localhost .vnc]# vncserver :10

New 'localhost.localdomain:10 (root)' desktop is localhost.localdomain:10

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:10.log

[root@localhost .vnc]#

Configure IPTables

Edit /etc/sysconfig/iptables and add

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5910 -j ACCEPT

Restart iptables

[root@localhost ~]# /etc/init.d/iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]
[root@localhost ~]#

Accessing

Open a VNC client and go to <machine>:10

Enter the password.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article