Enjoy folks, feel free to ask questions, I found this over on Gentoo's forums and there's a lot of informative stuff in that thread as well:

http://forums.gentoo.org/viewtopic.php?t=72893

Note: this guide is for Gentoo Linux, but it can be adapted to other linux distributions quite easily.

Turning your Linux box into an XVNC Terminal Server

1. Install TightVNC
Code:
emerge tightvnc
(for non gentoo users, rpm/tgz/deb install)

2. Install xinetd
Code:
emerge xinetd
rc-update add xinetd default
(for non gentoo users, rpm/tgz/deb it.)

3. Allow xinetd to listen to external calls
Find and open /etc/xinetd.conf

put a # in front of the following line:
Code:
only_from = localhost
4. Change the xdm configuration so that it listens to XDMCP requests:

Open /etc/X11/xdm/xdm-config

find the following line and comment it out by putting a ! in front of it:

Code:
DisplayManager.requestPort :0
5. Configure KDM (KDE Login Manager, if you have KDE installed and are using KDM as your login manager)
open /usr/kde/3.1/share/config/kdm/kdmrc and find the [XDMCP] section, change Enable=false to Enable=true

6. Configure GDM (GNOME Login Manager, if you use that)
Start gdmconfig and go to the tab "XDMCP" and make sure it is enabled

7. Specify access. open /etc/X11/xdm/Xaccess
find the following line and uncomment it:
Code:
#* * * #any host can get a login window
you will also have to do this for /usr/kde/3.1/share/config/kdm/Xaccess as well, i'm not sure about GDM and Gnome.

8. Add some services to the services file in /etc/services:

paste the following lines into /etc/services:

Code:
# 
# VNC Servers 
# 
vnc-640x480x8 5950/tcp 
vnc-800x600x8 5951/tcp 
vnc-1024x768x8 5952/tcp 
vnc-1280x1024x8 5953/tcp 
vnc-1600x1200x8 5954/tcp 

vnc-640x480x16 5960/tcp 
vnc-800x600x16 5961/tcp 
vnc-1024x768x16 5962/tcp 
vnc-1280x1024x16 5963/tcp 
vnc-1600x1200x16 5964/tcp 

vnc-640x480x24 5970/tcp 
vnc-800x600x24 5971/tcp 
vnc-1024x768x24 5972/tcp 
vnc-1280x1024x24 5973/tcp 
vnc-1600x1200x24 5974/tcp 

vnc-640x480x32 5980/tcp 
vnc-800x600x32 5981/tcp 
vnc-1024x768x32 5982/tcp 
vnc-1280x1024x32 5983/tcp 
vnc-1600x1200x32 5984/tcp
9. Create a file in /etc/xinetd.d/ called xvncserver, paste the following into it:

Code:
service vnc-640x480x8 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 640x480 -depth 8 
} 

service vnc-800x600x8 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 800x600 -depth 8 
} 

service vnc-1024x768x8 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1024x768 -depth 8 
} 

service vnc-1280x1024x8 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 8 
} 

service vnc-1600x1200x8 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 8 
} 

service vnc-640x480x16 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 640x480 -depth 16 
} 

service vnc-800x600x16 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 800x600 -depth 16 
} 

service vnc-1024x768x16 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1024x768 -depth 16 
} 

service vnc-1280x1024x16 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 16 
} 

service vnc-1600x1200x16 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 16 
} 

service vnc-640x480x24 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 640x480 -depth 24 
} 

service vnc-800x600x24 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 800x600 -depth 24 
} 

service vnc-1024x768x24 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1024x768 -depth 24 
} 

service vnc-1280x1024x24 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 24 
 * * * * *# port = 5973 
} 

service vnc-1600x1200x24 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 24 
} 

service vnc-640x480x32 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 640x480 -depth 32 
} 

service vnc-800x600x32 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 800x600 -depth 32 
} 

service vnc-1024x768x32 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1024x768 -depth 32 
} 

service vnc-1280x1024x32 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 32 
} 

service vnc-1600x1200x32 
{ 
 * * * * *protocol = tcp 
 * * * * *socket_type = stream 
 * * * * *wait = no 
 * * * * *user = nobody 
 * * * * *server = /usr/bin/Xvnc 
 * * * * *server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 32 
}
10. Restart xinetd:
Code:
/etc/init.d/xinetd restart
11. Restart the xdm/kdm/gdm service (this does end your xsession!!!):
Code:
/etc/init.d/xdm restart
(non-gentoo users, basically just restart the login manager you use, be it xdm, kdm, or gdm... since gentoo's xdm script reads the proper login manager to use from the rc.conf file, it's xdm for it)

12. test using a vncviewer session
Code:
vncviewer localhost:71
you should get a vnc session that is 800x600x24bit. to change the resolution look at the last two numbers of the ports used in the services file for each resolution and replace the numbers after the address (i.e. localhost:71) with the one you want.

vol