VNC on Fedora Core 6

Setting up VNC on a Linux box is always such a hassle. But I had to do it again today so that I don’t have to deal with two sets of mic and keyboards when I am testing my work in VMWare.

Thank goodness for this article that I saved a bunch of time having to figure things out myself. Maybe in the [always] good old college days, I’d have done that. But now time is of utmost importance with an active child in the house and all…

The only hiccups I got was that the above setup failed to discuss the issue with firewall and iptables. To allow outside access (even within the same home network), a port must be open to allow the traffic to flow through. There are a couple of ways to do that:

Adding a rule through a GUI in Gnome:

1. Go to System -> Administration -> Security Level and Firewall
2. (enter the appropriate password when prompted)
3. Under the Firewall Options tab, click on the white arrow at the bottom that’s labeled Other ports
4. Click on Add and enter the port number you are allowing access; in my case, it was 5902 for display number 2. (Leave the protocol at default, which should be tcp
5. Click OK all the way out, and iptables should have been restarted with the rule in place

A geekier way to do it is through command prompt:

1. sudo vi /etc/sysconfig/iptables
2. Add the following line to the rule:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT
3. Restart iptables by issuing:
sudo /etc/rc.d/init.d/iptables restart

Another thing that many Linux novice (like myself) don’t quite grasp is the fact that Linux’s GUI is not at all tied to the operating system. You can have Gnome, KDE, Flux or Blackbox as GUI options installed on the same OS. And you can switch around as you please upon setting the preferred desktop and log/in again. When you are viewing the remote system through VNC, you can do exactly the same thing — you can define what type of GUI you want to see as you launch your preferred VNC viewer client:

Edit /home/_vnc_user_name_/.vnc/xstartup as such:

# Uncomment the following two lines for normal desktop:
# 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" &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" -e ./menu &
#twm &
#fluxbox &
gnome-session &
#startkde &

Noticed I commented out (#) some desktop GUI options at the bottom except Gnome. Basically you can use any one of them anytime as long as you restart the vncserver after you’ve made the changes.

  • This is perfect. Thanks a million.

    Just uncomment
    # exec /etc/X11/xinit/xinitrc

    and you are ready to rock.