Remote Login with GDM and VNC on Fedora 11

Do you want the ability to VNC into your remote Linux computer and login to the GUI as if you were right next to the machine? Then you need to setup VNC with GDM. These steps were tested on Fedora 11.

Install VNC

You need to install VNC first. If it’s already installed, running the following command may either do nothing or upgrade it.

sudo yum install vnc-server

Turn Off VNC Service

sudo chkconfig vncserver off

sudo service vncserver stop

Install xinetd

You need to have xinetd installed. If it’s already installed, running the following command may either do nothing or upgrade it.

sudo yum install xinetd

Enable XDMCP

sudo vim /etc/gdm/custom.conf

Your file should have following lines (there may be other lines so leave them be)



Create VNC Service

sudo vim /etc/services

Edit the file so that the lines with vnc-server look like

#vnc-server 5900/tcp # VNC Server
#vnc-server 5900/udp # VNC Server

And add the following line

vnc1024 5900/tcp # VNC and GDM

Create xinetd Service

Create a file as below

sudo vim /etc/xinetd.d/vnc1024

And make sure the file has the following contents

service vnc1024
disable = no
socket_type = stream
protocol = tcp
group = tty
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp /usr/share/X11/fonts/misc -securitytypes=none

Restart xinetd

You should restart the xinetd service.

sudo service xinetd restart

VNC into the Server

Using a VNC client on another computer, try to VNC into the server. If it doesn’t work, you may have to restart the server.

sudo reboot

Hat Tips: Run VNC and GDM for headless boxes; VNC & GDM; Using remote X applications under Fedora Core 3 (re: xhost usage);

CentOS 5 Post Install Customization

I have collected these tips after testing them on Fedora or CentOS, but not necessarily on both. I have actually merged the article ‘Fedora 7 Post Install Customization’ with this one since CentOS and Fedora share many, many things. The Fedora article has been removed from the site. So you may want to update your bookmarks. These tips may be used as is or with some modification on almost all Red Hat-based distributions.

Remote Desktop Through VNC

This tutorial deals with setting up a machine for remote access. That is, other machines are able to access this machine through VNC. First, install a VNC server using the following command:

yum install vnc-server

To install VNC client,

yum install vnc

Open ports 5900 and 5901 on the firewall. If you want more than one VNC sessions to occur simultaneously, then open ports for those in your firewall. Say you want four simultaneous sessions. Then you would want to open ports 5901, 5902, 5903, and 5904. You may open ports in GUI or via command line.

Now make sure all users have their own .vnc directory in their home directory. For example, ‘testuser’ should have a /home/testuser/.vnc/ directory. If not, create one using

mkdir /home/testuser/.vnc/

Now setup VNC passwords for each user you want to allow VNC for. For example. if you want user ‘testuser’ to be able to VNC, log in as ‘testuser’ and run command


It will ask you to enter and verify your password. Remember, each user needs to set up their own password with this command. It will store password in /home/testuser/.vnc/passwd file.

Check to see if you have xstartup file in /home/testuser/.vnc/ and if not, create one using

vim /home/testuser/.vnc/xstartup

And make sure it looks like this:

# 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" &
startx &
exec gnome-session &

I chose GNOME because I use it on CentOS. If you prefer KDE, just change gnome-session to kde-session. Also, you have to make this file executable, using the following

chmod u+x /home/testuser/.vnc/xstartup

If you do not make this executable, and once VNC is all setup, you may only get a gray screen with a big black mouse pointer. If you make this file executable, this problem should not occur.

Another reason you may get this gray screen is when the character encoding of the file may not be what the scripts are expecting. To remedy this situation, make sure you use files created and modified on Linux. I had the same problem when I created a file on Windows and downloaded it in Linux. When I created the file in Linux, the problem went away.

Now, as root, you need to edit one file

vim /etc/sysconfig/vncservers

And make sure it has the following lines:

VNCSERVERS="1:testuser 2:otheruser 3:moreuser"
VNCSERVERARGS[1]="-geometry 1024×768 -depth 16"
VNCSERVERARGS[2]="-geometry 800×600 -depth 16"
VNCSERVERARGS[3]="-geometry 1024×768 -depth 16"

What we are doing here is setting up three VNC sessions for three users: testuser, otheruser, and moreuser. Add as many users as you want here. Remember, also open ports in firewall for each VNC session you open.

Be careful. After first installing VNC server, VNCSERVERARGS[1] will not look like this and would probably have flags set so that it doesn’t listen on network. You have to make sure your file looks like what has been shown above. Be careful that -depth is at least 16, not 8. Otherwise it may not work properly. Of course, you may set an appropriate screen resolution, not necessarily what has been set above.

Now you are ready to start VNC server as root.

service vncserver start

To make sure VNC starts up whenever the computer starts, do the following

chkconfig vncserver on

It should give you an OK for all VNC sessions you added in /etc/sysconf/vncservers. You will connect using your VNC client using the following address:

yourhostname :1

or you could use an IP address :1

Where :1 is the number chosen for the user in /etc/sysconf/vncservers. When asked, enter password for that user. The benefit of this method is you do not need to enable auto login to be able to use VNC.

I have to thank the following for helping me learn and also write about this issue: Tutorial: VNC; Set up the VNC server in Fedora;

Change Hostname

To change hostname to another, you need to take care of two things: change the /etc/hostname file and the /etc/sysconfig/network file.

sudo vim /etc/hostname

If there is already a name, replace it with the new one. Or if the file is empty, just add the new name.

sudo vim /etc/sysconfig/network

Change your old hostname to the new one.

sudo /bin/hostname -F /etc/hostname

Although you should not need to reboot, even if you do, the new hostname should show up every time. You may even logout and then login to see the new hostname in effect.

I had to learn these things the hard way but now I am able to share them with you.

Unable to Access Internet

If you are using static IP address and are unable to access the Internet while LAN access is going smoothly, try this: add a routing rule using the Network GUI with the following values. Of course, you would need to change the gateway’s IP to whatever IP your own gateway is using.


Allow a User to SUDO

I took this step as root, using instructions found in a good tutorial: Configuring SUDO.

su --login -c 'visudo'

Then I uncommented the line saying

# %wheel ALL=(ALL) ALL

and changed it to

%wheel ALL=(ALL) ALL

Also, I added the user I wanted to allow to use sudo by adding the following line below the line root ALL=(ALL) ALL. So now the file read

root ALL=(ALL) ALL
newuser ALL=(ALL) ALL

The user ‘newuser’ was then able to use sudo and it asked for a password every time.

Useful Resources

If you are looking to trim your CentOS install, you may find Building a Tiny CentOS Installation to be very useful.

Ubuntu 7.10 Post Install Customization

As soon as I installed Ubuntu 7.10 (Gutsy Gibbon), I took the steps detailed in this post. When Linux allows you to customize to your heart’s content, why not utilize the opportunity. Please remember some options may be highly unsafe and make your computer susceptible to malicious users. So please read more about security before attempting these things yourself.

Set Password for root

Ubuntu by default does not set a password for root while installing. So you have to manually set it. And it is as easy as:

sudo passwd root

You will be asked to set a new password and then confirm it.

If you want to change the password of your current user, just run


and enter the new password when asked. That’s all there is, folks.

Enable Auto Login

Go to System > Administration > Login Window and then the tab Security. Check Enable Automatic Login and from the User drop-down menu select the user you want to auto login. Click Close. Now whenever the computer reboots, this user will login to the GNOME session.

This is certainly not a secure option. However, I did this so that I may use VNC without messing around with settings that allow remote control without auto login. This takes me to my next step.

Enable VNC Remote Desktop

Go to System > Preferences > Remote Desktop. Check Allow other users to view your desktop, check Allow other users to control your desktop. Uncheck Ask you for confirmation and check Require the user to enter this password.

Along with auto login, this allows me to login and control my computer even if the computer reboots.

Disable Install CD as Resource for apt-get

Go to System > Administration > Software Resources. Under the tab Ubuntu Software, uncheck all options under Installable from CD-ROM/DVD.

I don’t like to put the CD in every time I need to install some packages. I also do not want to leave the CD in there. With a broadband connection, why bother? So I always disable CD as a place to look for packages. Now when I use apt-get, my system fetches the package from the Internet.

Change the Default Server for Packages

Go to System > Administration > Software Resources. Under the tab Ubuntu Software and the drop-down menu called Download from choose Other. From the list choose any server of your choice and then click Choose Server. You may wish to reload all packages through GUI or command-line with sudo apt-get update.

I don’t want to hit one server every time, especially when the same server may be chosen by default for many other users. This affects the resources of that server. Therefore, I choose some other suitable server. Usually it is a University close to my geographic location.

I also like to periodically change the server so that all are used fairly and I do not put a lot of burden on just one. My usage of the servers is not much but it is all about the principle of fairness.

Sync Your Clock

You can synchronize the clock on your machine with Network Time Protocol (NTP) servers automatically. To do this, just install an NTP client by running the following command:

sudo apt-get install ntp

Then right-click the clock, click on ‘Adjust Date and Time’ and select servers you want to use for this purpose.

BitTorrent Client

A fairly simple BitTorrent client is called Deluge. You can install it by

sudo apt-get install deluge-torrent

More Packages Please

I also like to install the following packages once I am done with the other stuff.

sudo apt-get install build-essential ssh vim screen smbclient zip unzip