Latest tutorial: Premium Flash Files | Ask Tutorial5! | Subscribe to RSS Register Login Find Hobbies
Advertisement
Do you need more help? You can now Ask Tutorial5! and get free support - Ask a question now!

Remote desktop connection server with Fedora

(6 votes)
Written by Michael D.   
linux4040-logo.gifIn this tutorial, I will explain how set up and configure a Linux box to accept incoming remote desktop connections.

In this tutorial, I will explain how set up and configure a Linux box to accept incoming remote desktop connections.

For this tutorial, I used a Fedora Core 6 server and a Windows XP client. If you use any other Linux distribution, the changes are minimal on the installation part.

 

1. Package installation


First of all, log on to your Linux server with your root account. To remotely use a graphical user interface in Linux, you must install X Window System and a Desktop environment first.

Check you current software configuration by typing "yum grouplist". It should bring up a list in your terminal containing the installed packages and the available ones. If "X Window System" and a desktop environment is already installed, skip to the next step.

If not, simply type

yum groupinstall "X Window System" and wait for the installation to complete after confirming the download and then

yum groupinstall "GNOME Desktop Environment" or
yum groupinstall "KDE (K Desktop Environment)", depending on the preferred desktop system you want to use.

 

2. Installing VNC Server


By installing the X Window System packages, vnc server should be installed automatically. If by any chance you do not succeed in following the next steps, getting errors like "vncserver: command not found" you should type "yum install vncserver" to resolve this issue.

 

 

3. Configure VNC Server

 

The first thing you should do is to create a VNC user and password profile. Type "vi /etc/sysconfig/vncservers" to edit a configuration file needed by the application. Add the following lines, like in the example bellow, following these criteria:

VNCSERVERS="id:username"
#where id is the display port of the X Server - put 5 for example.
VNCSERVERARGS[2]="-geometry <desired_resolution> -nolisten tcp -nohttpd -localhost"

01_etcsysconfigvncservers.jpg

Use the -nolisten tcp and -nohttpd for security reasons, unless you want to make TCP connections (VNC works based on UDP packets by default) or you want to use a web-based VNC session).

** If you are not familiar with vi text editor, try "nano /etc/sysconfig/vncservers" - it's a more intuitive editor.

Save the file and exit.

The next step would be to configure a VNC server password. At the command prompt, type "vncpasswd" and hit enter. You will be prompted for a password and then for a confirmation.

To start the screen, type vncserver id:username, eg "vncserver 5:root"

 

4. Configuring firewall rules

 

VNC server will listen for incoming connection on port 5900 by default. You need to mark this port in the iptables firewall too for connections to work.

To do this, add the line
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT

in your /etc/sysconfig/iptables file, by editing it with vi.

After saving the file, restart the iptables application to reload the config file and apply the new rule. Do this with the command "service iptables restart".

5. Configuring X Window System

 

The X Window System will not use vnc server by default. You need to edit some sections in the configuration file.

a. Type vi /etc/X11/xorg.conf

b. Search for Section "Module" - should be on the first page and add the line

Load "vnc" like shown bellow.

02_xorgconfig_loadvnc.jpg

c. Search for section "Screen" - should be in the last part of the configuration file and add the lines

Option "SecurityTypes" "VncAuth"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/userhomedirectory/.vnc/passwd"

Note that I used /root/.vnc/passwd because root is the username i configured. If you configure VNC for another account (specified in /etc/sysconfig/vncservers) tha path to the PasswordFile should be "/home/your_username/.vnc/passwd".


03_xorgconfig_passwdfile.jpg



Save the file and close the editor.

 

6. Starting X Server

If everything is ok, type "startx" to start the X Window System. The following display from X server and VNC should appear, and the shell will hang (stop the X server by pressing Ctrl+C at any time.)

 


04_startx_withvnc.jpg


 

7. Connecting to the remote VNC server


To connect to the VNC server from a Windows/Linux box, you will need a VNC client. Go to http://www.tightvnc.com/download.html and download a client suitable for your system (not the server - but the OS you'll use to connect to the vnc server).

 

05_vnc-connect.jpg

Install it, and run the viewer. Enter the remote server IP address and click Connect. You will be prompted for your password and then the connection should be up and running (wait a little for the desktop to initialize).

06_remotevncconnection.jpg



Subscribe now via RSS feed and get all the new tutorials

written by Matthew , November 27, 2007

This was nice and simple and it worked. Many thanks!
written by Matthew , November 27, 2007

Also, I tried this on Fedora Core 7 without any changes to the instructions. Worth noting that the command vncserver 2:root did not work, but vncserver by itself seemed to initialize things. I did this with the Firestarter firewall and running Gnome. I had already changed my gnome configuration to allow remote desktop "system, preferences, internet and network, remote desktop". Worth putting the 'require password option on'. I turned the 'ask you for confirmation' option off.
written by slonkak , December 08, 2007

I haven't tried this yet, because I don't think it will accomplish what I want to do. Maybe one of you can answer this. Does starting vncserver this way allow one to connect to the root session on a host? Meaning, if I boot up the box with vncserver set to run like this tutorial suggests, I use the machine, open a few apps, etc., then to go my laptop, can I connect back and get the exact same session I just left? That's what I'm looking for.
written by Mihai Dobos , December 08, 2007

Hello


If you login your box with the root account locally (not a remote administration line) and the session has vncserver started it will act like you want, keeping all applications opened. Your active session won't close; you just connect to it whenever you need.

If you do this, it is a good idea to keep a strong password to your vncserver connections, being a way to log in directly to your root account.
written by smbhat , January 07, 2008

in my box, I dont see xorg.conf file and startx throws fatal errors.

Also, I could not see iptables file under sysconfig
created a new file called iptables and added -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT to it. On restarting the iptables service, it failed to start.

any help?
written by Mihai Dobos , January 09, 2008

Hello

You should see both configuration files.. check if you are logged in with root account and if your installation is corrupted somehow.
written by pelle , January 26, 2008

how to save file???? its standing Save file and exit,,,, (nooob)

written by Mihai Dobos , January 26, 2008

Hello

In vi editor, press escape to exit from the Insert mode, then type :wq to write your changes and exit.

In nano, just follow the instructions at the bottom of the screen (Ctrl O to write, Ctrl x to exit). If you didn't save your work and typed the exit sequence, you will pe promted for saving the file unde the same name (default option) or as another.

If you are not sure of what you are doing, just make a backup copy before starting to edit files with the command "cp original_file backup_file "
written by pelle , January 26, 2008

Hello thanks for help,

when im typing yum install vncserver , it cant install , no more mirrors to try,, at the "yum grouplist" i have windows x and kde, so the problem is I cant install vnc,,
written by Mihai Dobos , January 26, 2008

Hello

If you get a timeout error with yum, it's better to try the install procedure a little later (some mirrors are down for maintanance usually). If you want to install the rpm by yourself, see http://www.rpmfind.net/linux/r...?query=vnc and download a version that suites your operating system.
written by WeBoat , March 22, 2008

I'm doing this to a remote server that has no graphics card(I think) and no monitor (I know). Can I still set this up and run vnc server?

Currently I'm getting a fatal error at startx: No Screens Found
written by rehan , April 29, 2008

hello,

i want to try this......will it work if i tried setting up rdc through my psp3???

Do you need more help? Ask now!
 

busy
Last Updated ( Saturday, 12 January 2008 )