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)

[xdmcp]
Enable=true

[security]
DisallowTCP=false

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);

41 Responses to Remote Login with GDM and VNC on Fedora 11

  1. Pingback: Setup Fedora 11 PV DomU at Xen 3.4.1 Dom0 (kernel 2.6.30-rc6-tip) on top of Fedora 11 « Xen Virtualization on Linux and Solaris

  2. Patrick Buchi says:

    Worked through this but still could not log on remotely. Locally trying to start vncserver complained about “no displays configured”.

    Had edit /etc/sysconfig/vncservers and add
    VNCSERVERS=blahblahblah
    VNCSERVERARGS[x]=blahblahblah

    Did I do something wrong or did you leave that part out of this tut?

  3. Patrick Buchi says:

    Okay, found the mistake:

    server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp /usr/share/X11/fonts/misc -securitytypes=none

    Looks like its 2 seperate lines but is actually all one line.

    Thanks for this, all working perfectly.

  4. David says:

    Ran through the tutorial. Servers up and running. Problem with client connection.

    Using TightVNC, the client connects but only shows a black screen with a GNOME X in the middle.

    Any thoughts?

  5. hs says:

    It happened to me as well. I rebooted the server and it worked. Try and see if it works for you.

  6. Just a small problem when i try to use bash on the cleint.
    To display gedit i need to enter this command first “export DISPLAY=:1.0”
    Can this be added to some script some where ?

  7. Robert Dehez says:

    Hi, I tried it with fedora 11 and gdm ans it works fine; but, as I prefer kde, I configured Fedora to use kdm instead of gdm. But, doing this, vnc does’nt work anymore … Have I something to change int the configuration to use kdm with vnc ?

  8. hs says:

    @ Philip: I am not very experienced in Linux so am not able to help you with this. A good forum should be able to help.

    @ Robert: I think you will have to enable XDMCP in KDM.

  9. Robert Dehez says:

    @hs : Thanks for your reply. I had already enabled xdmcp in KDM but it had no effect :-(
    It’s very strange : if I use vncviewer with gdm, I have the login screen, If I use it with kdm, I don’t have any connection. I verified firewall rules and I also opened port 177 for xdmcp, but with no result ….

  10. Robert Dehez says:

    I would like to precise that when I use vncviewer, I have a connexion but with a black screen … and, after a few minutes, the connexion die.

  11. Robert Dehez says:

    Ok, it works now, I just had to add at the end of the file : /etc/kde/kdm/Xaccess :

    LISTEN 0.0.0.0

    So your tip works fine also for kdm !!!! Thank’s a lot ! :-)

  12. Andreas says:

    Thanks for this good tutorial. Works fine for me but with one exception:

    When I have a remote session and want to do “root things” (e.g. System – Administration – Date & Time) a dialog opens up asking for the root password and after hitting OK nothings happens any more. The same for packet updates and all other windows requiring root authentication. A “su -” works well.

    Any ideas about that? I didn’t find any restrictions on root logins but I am not very familar with X-configuration.

  13. Trey says:

    I’m using Fedora 11. If nobody has logged into the box, I get a black screen with a cursor when I use vncviewer. However, if I log into the box directly, then I no longer get the black screen when trying to connect. This defeats the purpose though, since I cannot log in remotely until I first login locally at least once. Any ideas?

  14. ricbax says:

    I am trying o connect from a Mac using JollyFastVNC, the server closes the connection. I have opened the port 5900 but still it does not connect. Any suggestions?

  15. Louis says:

    Hello,

    I try to setup a server using fedora 11 64 bit. The server should be managed remotly, using using gnome via VNC .

    To make things short, despite a lot of searching and effort. I do not manage. I can not setup VNC in such a way that it provide me access to the logon screen (I can connect to a logged in user, but that is not very usefull here).

    I saw some solutions using XVNC (here foreinstance), however as far as I know XVNC is not available for FEDORA11.

    I am strongly considering to switch to another distribution (opensuse 11), since this is a blokking issue for me.

    But perhaps some one has a solution !?

    Sincerely,

    Louis

  16. John says:

    @Andreas: Your Gnome admin authentication issues more than likely have to do with PolicyKit. It is a stickler for terminals matching, xauth, etc.

    @Trey: the ability to log in remotely in F11 via VNC client only after logging in locally is due to ‘vino-server’, a small VNC server that starts only after a user logs in and has turned on ‘Remote Desktop’ in the ‘Preferences’ menu of their login session. Turn it off in your logged-in desktop session before trying any other VNC server tricks, or choose another port in the config for your VNC server. 5900 is the default, and vino uses it – try 5901 thru 5909.

    @ricbax: JollyFastVNC works splendidly for me to a F11 box, either with the above-mentioned ‘vino-server’ remote desktop, or Xvnc running with this tip. If you get disconnected immediately after connecting, it is usually because the Xvnc server is running but it doesn’t start an X session. Check the command line parameters under ‘server_args’ again – note as Patric Buchi said above the line is wrapped in the WordPress blog software here.

    @Louis: XVNC I believe is a named software (it gets confusing). Xvnc (note lower-case ‘vnc’) was the binary command name for RealVNC in Fedora, but since F11 it has been replaced with ‘TigerVNC’ (a branch of TightVNC). To make things easier the command names have remained the same (e.g. ‘Xvnc’). The new tigervnc server now uses the improved ‘Tight’ protocol versus the older RealVNC ‘RFB 3.8’ protocol, plus a few other benefits. Note that setting up a standard VNC server in F11 should not be that hard – the vncserver service init script handles most everything except passwords. Of course it doesn’t take you to a login window (gdm, kdm, xdm, etc.), you are simply attached directly to a desktop session once VNC’s authentication is satisfied. That is the reason for this blog post: to provide a means for *graphical* logins through a VNC session.

  17. Daniel Sales says:

    Very good tutorial but i have a problem.

    How i setup de vnc-server to alow auto-mount a pendrive like sandisk 16GB?

    Thanks

  18. sam i am says:

    I had the same problem with JollyVNC.

    Also, after report I type:

    sudo service vncserver status
    Xvnc is stopped

    is that right?

    So I type:
    > sudo service vncserver start

    and get:

    Starting VNC server: no displays configured [FAILED]

    which can’t be good but might be OK, it is not supposed to be running….

    Any help appreciated.

    Thanks in advance.

  19. hs says:

    @Daniel: I think you might not have to setup VNC for this purpose. You can look at mount, fstab, etc. for this.

    @Sam: In this way of using VNC, I believe you should not have vncserver running using service command. Xinetd is the one that takes care of it for you.

  20. LinuxLunatic says:

    This is great and worked the first time!

    Is there a way to add authentication (prompt the VNC Client for a password) for the initial connection?

    Also, is anyone else getting a bug report from Gnome when logging in? I am connecting to Fedora 11 running on VirtualBox with guest additions install and I think this may be due to the auto-resize feature of the VBox gues additions.

    —- Critical and fatal warnings logged during execution —-

    ** Gdk **: The program ‘gnome-settings-daemon’ received an X Window System error.
    This probably reflects a bug in the program.
    The error was ‘BadWindow (invalid Window parameter)’.
    (Details: serial 294 error_code 3 request_code 20 minor_code 0)
    (Note to programmers: normally, X errors are reported asynchronously;
    that is, you will receive the error a while after causing it.
    To debug your program, run it with the –sync command line
    option to change this behavior. You can then get a meaningful
    backtrace from your debugger if you break on the gdk_x_error() function.)

    Thanks!

  21. worked on CentOS 5.4 x86, many thanks!

  22. John M says:

    Worked first time. Can connect using TightVNC on Windows 7 box to a Amahi Home Server 5.2 (Fedora 12). Thanks.

  23. Dwain Sims says:

    A couple of comments and a question.

    1. This is really very well done overall. Thanks for doing it.

    2. It is important to note that you must open port 5900 in the iptables firewall for this to work on CentOS 5.4. Use system-config-securitylevel-tui to do this.

    The question is

    On CentOS 5.4, has anyone figured out a way to allow root to login via VNC per this procedure?

    (yes I know the perils of root login, but these are lab/devel/test systems in my case and being logged in as root just makes things easier)

  24. Claude says:

    Hi,

    I have the same problem, I can not log in as root but only as a user. I am runnng CentOS 5.

    There is an error message that gets displayed but it is on two lines and the second line gets overwritten by the login prompt!

    Anybody managed to log in as root???

    thanks

  25. Steve says:

    I’m just getting a black screen. I’ve uninstalled vino and rebooted, but I still have the same trouble. What else can be wrong?

  26. Steve says:

    Some more info…

    I’ve also tried changing the port number, with no difference in behavior.

    I’m running CentOS 5.5 with a standard Gnome installation.

  27. Schorschi says:

    Same black screen (of nothing) on Fedora 13. Anyone figure out this black screen issue?

  28. Pingback: Remote Login with GDM and VNC on Fedora 11 « Code Ghar « Gregory Reese Research

  29. Zerial says:

    Works fine!

  30. mefisto1504 says:

    Worked great in fedora 14, you are a genius !!! Thank you very much.

    I have some problems at beginning, the vnc viewer couldn´t connect to the server, but that was because I didn´t open the port 5900 in the firewall LOL, so the firewall was rejecting all the connections =D.

  31. Anonymous says:

    If you’re having an issue with a black screen showing up when attempting to connect to the VNC server, check out the following link for a fix that worked for me: http://www.thelinuxpimp.com/main/node/911

  32. ouh yeah says:

    If you want to be able to log in as root you need to add AllowRemoteRoot=true under [security] section of /etc/gdm/custom.conf At least that works in CentOS 5.7

  33. Louie says:

    In Fedora 16, there is a Desktop Sharing Preferences pane from the Applications -> Internet -> Desktop Sharing menu option. In the pane, you have to disable the “You must confirm each access to this machine” option in the Security section. Otherwise, you’re waiting on the black screen until someone at the terminal approves the VNC request.

  34. Alessandro says:

    that last reboot command break the suspension of disbelief and bouce us back to windows days…
    is there a way to activate the configuration without rebooting?
    i get a black screen until that

  35. Schorschi says:

    I have started using CentOS more than Fedora lately, since I just have been running into too many issues with Fedora lately. And I have not attempted as yet to implement this on CentOS. But I still have not been able to avoid the reboot thus far. In my experience the reboot is needed, there is something somewhere as yet not identified (from our experience) that the reboot resolves or addresses.

  36. Alessandro says:

    I’ve sorted the reboot out:
    you can avoid it by simply restarting only gdm as explained here:
    http://pleasedonttouchthescreen.blogspot.com/2012/01/xvnc-black-screen.html

  37. Schorschi says:

    Excellent, I am trying this out on centOS this weekend, but I expect it to work. To be honest I just have not had time to get back to this until recently… Been spending to much time goofying off with KVM, cough… RHEV.

  38. Schorschi says:

    Well, the gdm kill technique did not work on CentOS 6 (i.e. 6.2). I still had to do the explicit reboot. I did explicitly kill the gdm process, but I still go the black screen of death.

  39. Alessandro says:

    on CentOS 6, gdm won’t reload with a simple kill
    I used a kill -9 and it worked again

  40. gms says:

    good tutorial. For me, connection works fine. I used AllowRemoteRoot to login as root. That also works fine. But, System->Administration->Users and Groups menu doesn’t pop up a new window. Same with Authentication part. Any ideas?

  41. Pingback: Configuring VNC and GDM for remote logins | EpicRikerBeard