HOWTO: Remote Desktop with VNC in Ubuntu Edgy/Feisty


Updated, 4 May 2007: Warren helpfully pointed out in the comments a possible fix for the problem with the latest vnc4server. It worked for me in Edgy, and I hope it works with these instructions for Feisty Fawn also.

See below for info about the -extension XFIXES option, and for another necessary setting in 7.04/Feisty if you want to use multiple logins for a single user. Also see the related entry for this bug at Launchpad.net.

Last year I set up VNC Server in Fedora Core 5 (see below), and the instructions I followed had the added bonus of giving me resumable sessions, so that the remote session continues between client sessions. There is a long thread about setting up the same scenario in Ubuntu:

http://ubuntuforums.org/ showthread.php?t=122402

The discussion started as a howto on January 27, 2006 and it is ongoing as of a week ago. (And then today since I plan to point to this post from there.) It has carried on through a few versions of Ubuntu and had most of what I needed to get VNC working on GNOME in Ubuntu 6.10 (Edgy Eft), although it took the better part of a morning to piece together. Thanks to Tichondrius who posted the original instructions that I’ve built on below, and all of the posters who contributed further ideas and solutions.

I’ll try to present a coherent narrative of the install, but in reality I went back and forth, trying lots of different things, and probably did things that in the end weren’t necessary. I’ll mention some of the gotchas as I go and recap some others at the end. There are also a few errors and nags remaining that don’t seem to cause any larger problems that make me want to investigate right now.

There was much discussion in the big thread about issues specific to the AMD64. I completely spaced out on the fact that my system76 machine came with an AMD64 until after I had gotten things working. So I mostly ignored all that advice, probably to my detriment.

My understanding of this is very sketchy. Just following along and not really understanding what I’m doing. I know there are security concerns with opening some of this up. Please don’t take my word as final, and as always: caveat emptor.

Lights, Camera, Action

1. Enable Remote Access (XDMCP)

Edit /etc/X11/gdm/gdm.conf

sudo vi /etc/X11/gdm/gdm.conf (or gksudo gedit ... if you prefer)

(While writing this, I notice that the file has a warning that it may be overwritten on upgrade and recommends using another .conf file. Should really look in to that…)

Again, it sounds like there are security concerns here. The config file even says in that [xdmcp] section: “Distributions: Ship with this off. It is never a safe thing to leave out on the net.” My machines aren’t directly exposed to the Internet, so I’m ok with this for now. (Although I want to understand better what the risks are and how I can minimize them.)

Update, 4 May 2007: I’m not running Feisty 7.04 yet, but I booted up the Live CD to confirm that there is a new “General” tab in the Login Window Preferences dialog where you can enable multiple logins for a single user. (It’s phrased as a negative: “Disable multiple logins for a single user”. It’s checked by default so you’ll uncheck it if you want multiple logins; e.g. if you want to be logged in remotely and locally.) The Remote tab and XDMCP options in Feisty look a lot like Edgy’s, so I hope my instructions are still good in 7.04.

A note about software repositories and freedom

Next, the the instructions say:

“Note: Before doing the next step, you need to make sure the extra repositories (e.g. universe) are enabled:
http://easylinux.info/wiki/Ubuntu#How_to_add_extra_repositories

I was impatient the first time setting this up and didn’t really figure out what this meant. I felt like I was thrown in to the middle of something a lot more complicated than the VNC setup task at hand. I wanted to know what this stuff was, but not at that moment. There is a *lot* of stuff at that link, and it’s not at all clear what you’re expected to do in relation to the howto. This vague directive filled me with unease.

I think I understand better now. I knew that by installing stuff with apt-get, the software had to be retrieved from somewhere, but it was all mysterious and like magic to me. Now I see that Ubuntu has a way of categorizing different repositories, shown in the screenshot below.

I think the author of the howto was just pointing to the link as a shorthand reference that something needed to be enabled in order to get the required software. He was trying to explain VNC, after all, and not the world of Ubuntu software repositories. But it was disorienting and troublesome at the time.

And now that I have a glimmer of what these repositories are about — this universe and multiverse and whatnot, I object to how they’re presented in that link, and this other link I followed later, for a GUI alternative:

http://easylinux.info/wiki/Ubuntu#How_to_apt-get_the_easy_way_.28Synaptic.29

There’s no discussion of software freedom at these links (at least not that I saw in my brief review of them) — just the directive for you to enable access to all available repositories. I’d like to see a comment to the effect that you might not want to enable access to repositories that offer copyright encumbered and/or proprietary software. It seems this is one result of a culture where convenience is valued over principles.

To see where these repositories are configured in the GUI, take a look at System » Administration » Synaptic Package Manager, and then Settings » Repositories. You might see something like this:

Ubuntu Synaptic Package Manager Software Sources

I discovered my system76 Ubuntu machine came with all five checkboxes enabled, so it hadn’t mattered that I didn’t understand this when I got VNC working; I already had the universe enabled. I didn’t like that multiverse and the proprietary device drivers were enabled, and I turned those off.

I have mixed feelings on device drivers and get caught in the convenience trap myself. I believe hardware drivers should be free-as-in-free-speech also, but I’m willing to use some proprietary drivers to run current hardware. In the future I will try more and more to only use hardware that is supported by free drivers.

2. Install Required packages

sudo apt-get install vnc4server xinetd

Update, 4 May 2007: Previously there were problems with the latest vnc4server that required use of the downgraded vnc4server/edgy in the install above. I kept skipping the GUI software updater’s “Important security update” from version 4.1.1+xorg1.0.2-0ubuntu1 to 4.1.1+xorg1.0.2-0ubuntu1.6.10.1 because it would break VNC as described later in this post. Warren shared a workaround/fix for this problem that we’ll cover in step 4 below.

I was finally driven to learn more about the universe and multiverse when I tried this step on my laptop. There I had installed 6.10 Edgy myself and by default the universe and multiverse were not enabled. I was getting the error: “E: Couldn’t find package vnc4server.”, which was odd and disheartening when it had worked so seemlessly before. Google brought me right back to the big Ubuntu Forums thread where I now found a post from 2 Feb 2006 more relevant.

Here’s where GUIs can be nice for learning. The one link had described turning this stuff on, but it wasn’t until I finally looked at the GUI config screen that understanding started creeping in to my brain.

It helped having this problem and finding the solution — it can be so much better to struggle with something for a while to get new ideas embedded in your thick skull. I do enjoy learning this stuff and tinkering; it’s just that time isn’t as good of a friend as it was when I was younger.

I ignored the AMD64 note because I was oblivious to my own AMD64ness while working on this.

3. Set the VNC Password

sudo vncpasswd /root/.vncpasswd

4. Add VNC Service to xinetd

sudo vi /etc/xinetd.d/Xvnc (probably creates a new file)

Add this:

service Xvnc
{
	type = UNLISTED
	disable = no
	socket_type = stream
	protocol = tcp
	wait = yes
	user = root
	server = /usr/bin/Xvnc
	server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd -extension XFIXES
	port = 5901
}

You can tweak these settings, obviously. For example, you might want a bigger resolution of 1152×864 or 1280×960. The original instructions had the font path as /usr/share/X11/fonts/misc. That must have changed somewhere along the way. (Thanks to MBaran for pointing out that one.)

Update, 4 May 2007: -extension XFIXES is the new setting that seems to work with the latest vnc4server. I don’t know what it is or what it’s for. Doesn’t appear in the man page. How do people find this stuff? All I know is that it’s nice when they come to me with the fix. :-)

5. Restart xinetd

sudo /etc/init.d/xinetd stop
sudo killall Xvnc
sudo /etc/init.d/xinetd start

Try it!

From the machine that we just installed VNC server on, try:

vncviewer localhost:1

If all went well (ha!), you should be prompted for the VNC password, and then see the GDM login screen where you can enter your Ubuntu username and password and start a new X session. Then you can move on to trying a VNC client from another GNU/Linux machine or Windows, specifying something like this for your server: 192.168.1.100::5901.

Broken eggs from whence came the omelette

I had lots of errors while doing this. One problem was that it wasn’t until much later that I found out how to enable XDMCP in the gdm.conf file.

When I first tried vncviewer localhost:1, I got:

scarpent@prometheus:~$ vncviewer localhost:1
VNC viewer version 3.3.7 - built Jul 4 2006 10:04:48
Copyright (C) 2002-2003 RealVNC Ltd.
Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
See http://www.realvnc.com for information on VNC.
ReadFromRFBServer: rdr::SystemException: read: Connection reset by peer (104)

Is xinetd listening?

I picked up some troubleshooting techniques from the thread. After restarting xinetd in step 5, you can check that xinetd is listening on port 5901 by doing:

sudo netstat -tap | grep xinetd

You should see something like:

tcp 0 0 *:5901 *:* LISTEN 10932/xinetd

I didn’t get that. I rebooted the machine and then saw something similar. (Just a different process id than 10932.)

But I was still getting connection reset by peer.

What’s going on under the covers?

There is a log to check:

grep xinetd /var/log/syslog

From which I got lots of stuff, including:

ubuntu xinetd[4829]: warning: can't get client address: Transport endpoint is not connected
ubuntu xinetd[4830]: warning: can't get client address: Transport endpoint is not connected
ubuntu xinetd[4268]: Deactivating service Xvnc due to excessive incoming connections. Restarting in 10 seconds.
ubuntu xinetd[4268]: Activating service Xvnc

Is Xvnc running?

And:

ps -ef | grep Xvnc

Which told me I didn’t have Xvnc running. The thread has a way to manually start Xvnc on yet another port (5902), but I never did get that working (although it generated clues). With:

Manual attempts and clues

sudo Xvnc :2 -query localhost -geometry 1280x960 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd

(warning: wrong font path), and then with:

vncviewer localhost:2

I got:

Xvnc Free Edition 4.1.1
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 70000000, The X.Org Foundation

vncext: VNC extension running!
vncext: Listening for VNC connections on port 5902
vncext: created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/share/X11/fonts/misc, removing from list!

Fatal server error:
could not open default font 'fixed'

Which was hinting at the font problem that a later post explained, so really:

sudo Xvnc :2 -query localhost -geometry 1280x960 -depth 16 -once -fp /usr/share/fonts/X11/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd

After finding that, I restarted the xinetd stuff again but still couldn’t find Xvnc with grep, so I tried the manual method again, this time getting:

vncext: VNC extension running!
vncext: Listening for VNC connections on port 5902
vncext: created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy
FreeFontPath: FPE "/usr/share/fonts/X11/misc" refcount is 2, should be 1; fixing.

vncviewer localhost:1 now prompts for password but then ReadFromRFBServer: rdr::EndOfStream
vncviewer localhost:2 vncviewer: ConnectToTcpAddr: connect: Connection refused
Unable to connect to VNC server

What’s this XDMCP stuff?

I finally got around to the XDMCP enabling in gdm.conf, rebooted, and still no Xvnc with grep, and still with the end of stream when trying to launch the local viewer. I tried with the Windows vncviewer and got a password prompt, but then connection closed.

(NOTE! Update, 4 May 2007: This next part about vnc4server/edgy should be taken care of by the instructions above, so that hopefully you won’t need the older version of vnc4server. I’m leaving it in here in the hope it still may be useful as a reference/clue/hint for other searchers.)

More poking around and restarting and trying the same things with the unrealistic hope of a different result, and then this, which I probably had seen more than once earlier:

vncext: VNC extension running!
vncext: Listening for VNC connections on port 5902
vncext: created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy

That rang a bell, with all the discussion of the problems with the latest vnc4server. I had downgraded and upgraded several times, and now I tried downgrading again:

sudo apt-get install vnc4server/edgy

And… at last! Using the local vncviewer worked!

(But remember, using the -extension XFIXES setting should make using the /edgy version unnecessary. And it’s possible the downgraded version doesn’t work correctly on Feisty in any case.)

Open Issues

Logging in from :0 and :1 at the same time

If I’m logged in to the computer locally (display :0), and then I try connecting remotely with a VNC client (display :1), I get a warning that I’m already logged in, with the options to “Log in anyway” or “Abort login.”

Ubuntu Already Logged In

This may not be a problem. I think Fedora does something similar. But then there is a crash in Ubuntu. This only happens in the situation of logging in to both local display :0 and remote display :1 at the same time. “Bug Buddy” points the finger at Evolution (apparently): Backtrace was generated from '/usr/libexec/evolution-alarm-notify'.

Ubuntu Evolution Alarm Crash

I’m not currently using Evolution, and I don’t notice any ill effects from this.

Can’t start instances of Firefox in two different sessions

Trying to start Firefox results in a message box: “Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.”

Going back to the local logon, Firefox is still working fine. I wonder if this has to do with the Firefox profile? I think later I’ll try starting with a different profile to see if that works around the problem.

Keyboard Settings

If I log on to the local machine and then log out and then in again via VNC, or vice versa, I get a message about the X system keyboard being different from GNOME keyboard settings.

Expected was model "pc105", layout "us" and option "lv3 lv3:ralt_switch", but the following settings were found: model "generic", layout "us" and no options.

Ubuntu Different X and GNOME Keyboard settings

Don’t know what that means. Doesn’t seem to matter which I pick. I suppose I can just tell it not to warn me anymore. I’d like to know what this is about but it goes on the long list of things that can wait for later.

Shared VNC Password

Finally, it appears that with this method you have a single VNC password, and can only have one user connect at a time. The original HOWTO says:

Note about security: This setup allows any user to start an X-session remotely by logging in using his regular password (after starting the VNC connection using the VNC password), so if the user disconnects without logging out, any other user which knows the VNC password can connect afterwards and resume the same session that the first user started. So if you do not want to log out before disconnecting, it’s advisable to at least lock your VNC X-session screen. Also note that while a remote user is connected thru VNC, no other connection will be accepted. An idle VNC client will be disconnected after one hour, but this can be changed by using the “-IdleTimeout” option in the server_args line in /etc/xinetd.d/Xvnc. For example, you can add “-IdleTimeout 300″ to change it to 5 minutes.

The method I used in Fedora will allow multiple users, each with their own port and session. I’m guessing something similar could be done here. Since I’m the only one connecting remotely on my network, I’m not going to worry about it right now.

What about that Fedora install?

The Fedora install is fading in to the past and I won’t be posting a HOWTO for it, but here are two pages that I think gave me just about everything I needed:

Last Call

Phew! This turned out to be a long post. I hope it helps at least one person. If that person is you and you want to show your appreciation, please consider throwing a few coins in my tip jar by buying something through one of my Amazon affiliate links. :-)

If you enjoyed this article, please subscribe for free!
Via the atom or rss feed, or enter your email address to get updates when new entries are posted:
(Your email will not be shared nor used for anything other than sending new posts. See the policies page for more about subscriptions and privacy.)

You can skip to the end and leave a response. Pinging is currently not allowed.

Comments

  1. Thanks a lot! It finally worked, I had almost given up when I found you and made my life shine again.

  2. […] Read more […]

  3. This is an excellent HowTo which finally got my VNC Problem fixed!

    Thanks A Lot!

  4. Anaspeople and WizZzard: You’re welcome, and thank you for commenting. It’s good to know if people find these write-ups helpful.

  5. Hi! I have the same problem as you. Every line in the guide has been the same as I have. But when I try to reinstall vnc4server/edgy I get a message saying that I already have that version installed. I am able to start the server manually on port 2 and when that runs I can connect with tightvnc. However I’m unable to get it to work automatically after the system is booted.

  6. Well it’s a good sign if you can get it work manually. I suspect a little more chipping away and you should have it.

  7. You are the man!!! great tutorial, pointing out All possible cases.

  8. To get multiple instance of Firefox (or any other Mozilla application) running simultaneously you need to set the environment variable MOZ_NO_REMOTE=1 before starting Firefox.
    To do this just use:
    export MOZ_NO_REMOTE=1

  9. Thanks, Bob. I later experimented and saw that it worked if I used a different profile, but this may work out better. Maybe put the export in .bashrc so it’s always ready? (I won’t need this very often, but when I do, I’ll be sure to forget the var name!)

    (And thanks for your page about installing VNC on Fedora — it was very helpful to me.)

  10. I sure could use some help getting to the goal line. I think I’ve followed the tips and instructions here (thanks for the detail).

    My last hurdle was the SecurityPolicy file which was in some obsure place in v6.10 Desktop. I copied it to the right place and using the manual method, I can connect to myserver:2, authenticate with the vnc password, and I get a window.

    BUT the window is just grey with the x cursor. I get no login prompt.

    Any ideas where I should look?

  11. Hi, Robert. I wish I had some advice for you on the grey window — I saw in the ubuntuforums thread that a lot of people see problems with that, but I didn’t run in to it so I don’t have any ideas there. Do you have all the XDMCP stuff set in the GUI and gdm.conf?

  12. Does your method allow user1 at machine1 to login to the Ubuntu server at machine0 at the same time as user2 at machine2 and show them their own different independent desktops and different running applications?

    If not (and the vncuser will always see whatever is onscreen), I think all I did on 6.06 LTS was install a vncserver (and setup a vncuser), possibly also sshd, and maybe graphically set allow remote logins. I ran machine0 headless and have the screensaver lock at the lowest time (1 minute I think).

    I would like to get the setup in my 1st paragraph (and hopefully secure). Can anyone show how?

  13. Hmmm. Does Edgy not do this?
    I just reinstalled 6.06 and all I had to do was graphically:
    System | Preferences | Remote Desktop
    Check both Allow other users to view and control
    Uncheck Ask for confirmation
    Supply a Password.

    I used realvnc viewer from a remote machine and I’m in.

    No XDMCP setup.
    No Allow remote logins setup.

    But I still want a multi-user remote login with separate views.

    Is it possible?

  14. I think you’d have to set up two different instances of Xvnc on different ports. (I wonder if you just copy the section in gdm.conf and make the port different in the second one if that would do the trick?)

    I’m guessing also there must be some way also to have different VNC passwords so that each user has their own. (Otherwise someone could log in to the other port and see the other desktop.)

  15. man i have a little prob… i can connect to both 0,1 displays but i can’t connect to display 1 with vnc over ssh.though i can connect to display 0 with vnc over ssh and display 1 with plain vnc (in port 5901)…any proposals?

  16. Sorry — haven’t looked in to ssh yet.

  17. Thanks for the write-up.
    I didn’t have any of the troubles you discuss here (I just used the “Remote Desktop” option in the control panel.)

    BUT, I did come here and find what I was looking for - “configure different screen resolution for vnc ubuntu”
    and the clue you gave when editing the /etc/xinetd.d/Xvnc
    file manually. I can now set my remote sessions to have a slightly smaller resolution that the default monitor sessions and hence the window on my PC desktop just fits inside my workspace with taskbar so I don’t get trivial scrollbars all the time.

    So my PC is set at 1024×768, and the VNC portal now loads as -geometry 1000×700 and is maximised without being fullscreen.
    … I knew it would be easy somewhere. Thankee for pointing in the right direction.

  18. thanks a lot dude! finally it resolve my issues with this damned VNC server!
    your post has saved many hours of my time!
    :-)

    cheers,
    enrico

  19. Thanks for the feedback, Dan and enrico — it’s good to hear this stuff is useful. :-)

    Dan, along with another comment above about simply enabling this in the GUI, it makes me wonder if I’m going about this in a much more difficult way than necessary. (Along with a lot of other people.)

    Or maybe this stuff is necessary to have multiple logons, resumable sessions, separate remote and local sessions, etc.

  20. I had hours of fun trying to get this work, with all sorts of strange errors. Finalyy I got it down to “cannot open display” - which turned out to be the resolution I had specified (1024 * 768) wasn’t in the xserver.conf file. Just in case anyone else has the same problem: I changed it to 800 * 600 (which is supported and is what I normally use for vnc anway) and it all works just fine.

  21. Thanks, Ian. Hopefully that will lodge in my memory and I’ll think of xserver.conf when I need it for some future screen resolution tweaking.

  22. […] GDM + VNC + Ubuntu Edgy […]

  23. Nassos, how did you make vnc avaialble for multiple user via diff sessions?

  24. Thanks, man, worked like a charm.

  25. That’s good to hear, Radu — you’re welcome and thanks for commenting.

  26. […] Searching around, I find people having other problems with 7.04 and other builds of vnc, and someone who is seeing the same weird dialog box I am (but of course, his keyboard works fine). Nothing conclusive on the ‘net from a lot of searching and poking around. […]

  27. There is a much easier way to do this!

    Prerequisites: Have ssh installed and running. Have one or more user accounts, ideally with different passwords. Have VNC, RealVNC or TightVNC installed. Make sure that you can start the VNC server manually from a terminal by typing “vncserver” (with or without args, like depth, resolution, etc.) You know it is running when it tells you VNC is starting. The first time any given user starts the VNC server it will ask for a password; note that you can use a different password to log into VNC than the user’s Ubuntu password. To kill a running VNC server, type “vncserver -kill [:(port number, if used - see below]

    a) log into your box with ssh. I presume you can enable ssh and have it listen on a port. If you have Webmin installed you can configure ssh to listen on something other than the default port of 22, which seems to help with dronebots that are constantly trying to probe for ssh servers.

    b) once you have a remote terminal, just issue the command ‘vncserver [:port]’ - If you want Joe to log in at :2, then his command would be ‘vncserver :2′ - you can append args like ‘depth 24′ or ‘resolution 1024×768′

    You can have multiple vnc servers running simultaneously - so if Alice logs into the box she could run ‘vncserver :3′

    Of course your firewall needs to either open or map the appropriate ports.

    c) to connect from a client machine, start the vncviewer - I do it from the Run Application gnome applet. A typical command would be ‘vncviewer myremote.machine.com:2′ - and then I would have access to Joe’s VNC server above.

    Note that this method does NOT let you share the screen with a local user; that is, you can’t say to Joe, “watch this, I am moving the mouse now,” since he is looking at X session 0 and you are looking at X session 2.

    However, it does let you run multiple simultaneous (Alice and Joe) copies of Firefox. Linux is inherently multiuser; Ubuntu lets you easily run three or four VNC remote sessions simultaneously.

    (If you must share the desktop with Joe in realtime, you’ll need to use the builtin ‘Vino’ version of vncserver, accessible from the Remote Desktop menu item on the Administration menu.)

    Good Luck!

  28. Thanks, Mallard. I might not be able to try this right away, but I’d like to see if I can get it to work sometime.

  29. Scott,

    There is a way around the Edgy/Feisty vnc4server problem: add -extension XFIXES to the server_args in step 4.

    Feisty now defaults to not allowing multiple logins for the same user, so you might find yourself not being able to login. To change this, go to Applications -> Settings -> Login Window. There is a checkbox under the General tab. This is all for Xubuntu, BTW.

    See here.

    Regards

    Warren

  30. Hi, Warren. Thank you for sharing that. I’ve updated the post and am happy to see this (apparently) resolved.

    You created some work for me — I felt compelled to download Feisty to verify the new tab and option in the login window prefs. Maybe I didn’t trust you, or maybe it’s just QA in the service of my readers. :-)

    Mallard: I’m still keeping your advice in mind since I may want to run multiple remote login windows to my box and I can’t do it with my current setup. I’m not sure I always want to have to log in with ssh first to start things. I like just popping up a VNC viewer and getting right in.

    Anyone: Please let me know if this guide is holding up ok. I’d especially like to hear if it works from start to finish on 7.04/Feisty.

  31. I have a wireless internet connection for my laptop, my computer running Feisty is connected directly to the wireless router. When I try using vncviewer mydesktop:1 on the client side, I get a “Couldn’t convert “mydesktop” into host address” or something similar. Is the command wrong or should I have specified something?

    Thanks,
    Anonymos

  32. Are you trying to connect to a remote server with your laptop? Is your laptop “mydesktop”?

    I usually run tight vnc from my Windows machine and specify the server as (for example) 192.168.1.50::5901. Or I assign a name in /etc/hosts (in Unix):

    192.168.1.50 servername

    And then can connect to servername::5901.

    There’s also a hosts file in Windows, maybe C:\WINDOWS\system32\drivers\etc\hosts.

    If “mydesktop” isn’t specified in your hosts file or defined somehow, maybe you’ll have better luck with an IP number?

  33. I can confirm that your instructions work start to finish with 7.04. Installed Feisty a few days ago and was fortunate enough to stumble upon your blog when I went looking for how to get VNC set up. I’ve got 2 simultaneous sessions going right now. Thanks!

    One question for the audience: The local machine is a mythbox connected to a SD TV - resolution set at 800×600. When I do want to try and see the local user’s desktop using my windows VNC client and Remote Desktop, I get a scrambled screen … unless I switch the local resolution to 1280×1024. Any ideas on how to fix this?

  34. That’s great, scram. Thanks for letting me know.

  35. Oh yeah, one last tweak for Feisty (and maybe others)-
    My xorg.conf default resolution depth is 24, so I found I got much better performance when I set “-depth 24″ in the Xvnc file.

  36. If you are having trouble using this with multiple users in Feisty, there is a simple fix.

    Go to System > Administration > Login Window

    On the “General” tab uncheck the box marked “Disable multiple logins for a single user”

  37. Hi Scott,

    I want to offer my sincere thanks for an excellent guide. I’m also happy that you’ve changed it to be “how to do it” separately from “what you did to get it to work”. Your latest fix in the XVnc file worked perfectly.

    You have saved me a lot of frustration. I have agonised over the VNC issue since I first installed Ubuntu (a few months ago).

    The Ubuntu experience has been a mixed one for me, but your page has definitely been one of the highlights :)

    Regards

    Walter

  38. Hi, Walter. You’re very welcome — I’m glad you found this helpful.

    I’ve had my frustrations also, but the more I do, the more comfortable I feel using GNU/Linux and confident that I’ll be able to figure things out. Let’s hope this keeps taking off so we can get more hardware support, which will eliminate a lot of headaches with using free software.

  39. Hi many thanks from France

  40. works perfectly with Feisty 7.04 !
    Many thanks again

  41. The solution worked for me for the VNC. Thanks! However after a restart the local desktop disappeared through the remote one still works ! Any tips ?

  42. Great. Been wanting to try VNC for awhile, This was a great help. Many Thanks

  43. i followed your instructions and tested with the following command / output / screenshot:

    $ vncviewer localhost:1
    VNC viewer version 3.3.7 - built Mar 8 2007 21:56:52
    Copyright (C) 2002-2003 RealVNC Ltd.
    Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
    See http://www.realvnc.com for information on VNC.
    VNC server supports protocol version 3.8 (viewer 3.3)
    Password:
    VNC authentication succeeded
    Desktop name “x11″
    Connected to VNC server, using protocol version 3.3
    VNC server default format:
    16 bits per pixel.
    Least significant byte first in each pixel.
    True colour: max red 31 green 63 blue 31, shift red 11 green 5 blue 0
    Using default colormap and visual, TrueColor, depth 24.
    Got 256 exact BGR233 colours out of 256
    Using BGR233 pixel format:
    8 bits per pixel.
    True colour: max red 7 green 7 blue 3, shift red 0 green 3 blue 6
    Using shared memory PutImage
    ShmCleanup called

    http://img295.imageshack.us/img295/861/screenshotpm4.png

    Obviously, not a sign on screen..I ran the same command, but with :0 and it logged into my current session with an infinite regression feedback loop…nothing serious, just hard to escape from like a house of mirrors. Anyway, not sure what went wrong with :1 and why it only shows a grey X screen with no login…

  44. Hi, Ben. I’m just a dabbler so it’s hard for me to say, but did you configure XDMCP both in the GUI and in gdm.conf? It seems to me that could cause you to not get a remote greeter when you get connected.

  45. Thanks Scott. I seemed to have got it to work. I had forgotten the setting ‘Enable=True’, then I rebooted and it worked on :1

    Here’s a link to my gdm.conf file, just in case you think I missed something. Also, I believe I need to make these edits in /etc/gdm/gdm.conf-custom in order for them not to be overwritten.

    One question though: isn’t this all very insecure? I’ve heard that anyone could intercept and read the data stream and that it’s better to encrypt by tunneling through SSH and port forwarding. I’m looking into that now, since I don’t want anyone snooping on my remote sessions.

  46. Yes — very insecure. I think you’d want to use ssh over the Internet, and there are probably some other risks to be aware of also. I’m only using on my local network, so it’s not a big concern for me at this time. (Maybe I should be more explicit about that above…)

    I still haven’t gotten around to using the alternate .conf file to avoid overwrites. I figure I can just set it up again or figure it out if/when that happens.

    Glad to hear it’s working for you now.

  47. Followed your tutorial and it works perfectly!

    Thanks a lot!

  48. Dude, you’re all over google and you rock! Saved me, thanks!

  49. Thank you Scott!!!
    After close to 3 days of following FAQs and HOWTOs I was about to give up and go to some other solution - and I am technical! The fact that you did a current piece on a hot topic relating to a very popular up-and-coming product (distribution). I feel better knowing I wasn’t the only one fighting those feisty ;-) little bugs. Seriously, it’s not that feisty should be faulted in the least. The teams working on all the *Ubuntu’s (I’m working with Edubuntu for kids) are fantastic and have done a wonderful job. Being a developer for more than 10 years I can appreciate the work that goes into this. The big difference with these folks is that they are not only working with changing requirements, but since they are integrators of code across the globe that literally changes constantly. My hat is off to them.
    Thanks for putting together this great piece.

    I am working on scripting this process for automated installation on computers donated to special-needs kids. Your effort will help each and every one of them. Oh - no, the kids won’t need VNC but I most certainly will to help them out!

    Joe
    www.jacobsontech.com

  50. You’re very welcome, and thank you, Joe, (and a belated thanks to Bryan and others who took time to leave feedback recently).

    I’ve been surprised by the popularity of this post and that so many people are looking for this topic. This post has over a quarter of my page views over the past three months. I’m glad to be able to help out and hopefully give back a little bit for all the great free software and help I’m getting myself.

    Mentioned in the comments above is another way of doing remote control in Ubuntu that should be very easy to set up — I’m planning on trying it out on my latest install where I haven’t set anything up for VNC server yet. I think the “harder” method may be preferred for several reasons, but I’ll update this post with my experience.

    I’d appreciate it if you’d drop back in and write about or link to any scripts you come up with, if you think they can be used or adapted by others. These are the kinds of things that will help us keep spreading the word.

    Thanks again for visiting and for commenting!

  51. Great information! Very helpful, Thank you very much!

    robert

  52. In CentOS, I am able to remote control same user session login at the console. In Ubuntu, the remote and local sessions are always different despite using the same user account. I am wondering if there is a way to do the same like in CentOS…

  53. Hi, Roysten. I think that’s how the easier built-in method works. I tried a quick experiment with that but had problems with scrolling when the remote computer had a larger desktop area than the local one. But I was definitely controlling the “local” session of the remote box.

  54. Thank you very much for your time posting this!!

    I wish it came up higher in Google, or that I was more patient and distilled a few posts before wasting my time. Your post worked first time on Ubuntu Feisty on an AMD64 X2.

    To use the modern parlance, you rock!

    Cheers,

    Erik.

  55. Thanks, Erik — glad to hear it!

  56. Hey Scott, were you able to see all the programs started at the local console?

    In my case, when I vnc from windows to the ubuntu session, I get a completely new screen without seeing any of the programs I have started at the console login…

  57. When I tried the “easy” way, yes.

    (But the instructions in this post will get you a separate session.)

    Do you have System » Preferences » Remote Desktop enabled (with allow others to view and control your desktop both checked), and then have you tried connecting with VNC to machine_name_or_ip:0?

  58. Ah, now I know I have missed the obvious. It has been stated in the Remote Desktop dialog to specify “:0″ in vncviewer.

    Thanks much for your pointers. It is now working perfectly for me.

  59. […] Agora, para facilitar ainda mais nossa vida, podemos fazer Remoting Desktop pelo VNC, e sua instalação é bem simples, conforme este tutorial que segui para o Ubuntu: […]

  60. Thanks for posting. My VNC now works. Without your post I would still be wandering in the wilderness. Thanks again!!

  61. You’re welcome, Don, and thanks!

  62. I always thought multiverse was required for using the system. I didn’t know you could turn it off.

  63. Sorry, I meant restricted, not multiverse.

  64. Hi, l.e. Yep — it can be turned off. It’s probably more or less required for a lot of hardware configurations which is probably why it is turned on by default. I’ve turned it off, although I would probably enable it temporarily if I had some device that wouldn’t install. My plan in the future is to spend more time researching hardware purchases to make sure they have free drivers.

  65. […] HOWTO: Remote Desktop with VNC in Ubuntu Edgy/Feisty This one works! (tags: linux ubuntu vnc remote) […]

  66. Great help. Many Thanks from Brazil, without your post no VNC working for me.

  67. Hi, Marcelo. Thanks — glad to hear this was useful for you.

  68. hi guys,im new to linux and i have one question.I’ve enabled the remote desktop in ubuntu but when i log on from my windows PC i can view the ubuntu’s desktop only and not control it.
    I’d like some help please.

    Sorry for my bad English.

  69. Hi, Alex. If you followed the instructions and read through the comments here and are still having problems, then a better bet is to use the Ubuntu Forums, and try posting more detailed information — there, not here — about your situation: what you’ve tried, etc. Good luck.

  70. the problem is that i can connect and view my linux desktop through vncviewer on my windows pc but when i move the mouse cursor on my files i cant click them or anything…i can only view the ubuntu desktop through vnc in windows. The strange thing is that IF FOR EXAMPLE i click a file that i have on ubuntu desktop FROM THE VNCVIEWER IN THE WINDOWS I DO NOT SEE anything happening but when i check the computer that runs ubuntu i can see in the screen that the file has opened on my desktop.
    Generally the mouse clicking i do in vncviewer in windows when i log on to my ubuntu’s desktop interracts with the linux pc only. i have to run to my linux pc to see what i’ve clicked,opened, etc..
    i hope that helped you a bit.
    Again sorry for my bad English.
    Thanks in advance.

  71. hm….i solved it finally..the problem was that i had the 3d desktop interface enabled..
    thanks anyway

  72. […] My first and primary goal was to get VNC (remote desktop) loaded on it.  As easy as VNC is to install and get ready, I thought it would be equally so with Linux.  I originally had a lot of trouble actually getting VNC server to start (library issues galore), but then I ran unto this number: setting up VNC server with resumable sessions (also see this howto), but here is the kicker: they don’t interfere with any user of the actual machine.  It basically creates another instance of the desktop for the remote user to login to (so the physical and remote user don’t interact with the same desktop).  Pretty suave. […]

  73. In reply to comment 30: You shouldn’t have to manually log in using SSH if you use the -via switch. Additionally, the potential complexity here is a great candidate for automation. I use the following script to power a menu item (configured via alacarte):

    #!/bin/bash
    
    status=0
    
    function start {
      vncviewer -fullscreen -xrm "*passwordDialog:true" -via scott-desktop.mss scott-desktop.mss:$1
      status=$?
    }
    
    for i in `seq 0 10`; do
      start $i
      [[ $status -eq 0 ]] && break
    done

    As you can see, it’s establishing an SSH connection, then connecting to it. It also searches for the first available display. That’s so if I’m logged onto the server already, my client will connect to the existing session (provided that vino-server is running).

    Now, I’m trying to figure out how to start a VNC server on :0 in GDM, so that I can log in on the server from a VNC session on the client.

  74. Thanks, Scott. I’ll keep your advice in mind when I finally get around to trying out VNC over SSH.

  75. First of all using version 6.06 Ubuntu.
    I do not have a System -> Preferences -> Remote Desktop.

    Secondly, I get a client session but it is all gray, no X11 login screen.

  76. I’ve configured vnc to be run as a X module, so no Xvnc process is created at all. I use it to allow the screen to be seen even without loggin in.

    I’m wondering if there is any way that I can see who is connected viewing the desktop, so I can monitor them and even disconnect them.

    Do you know how can I do this?

  77. Hi, Wesley. I’m guessing there is a way but I don’t know what it is.

  78. So, I followed your tutorial exactly (on 7.10) and got exactly your problems. I got up to:
    “After finding that, I restarted the xinetd stuff again but still couldn’t find Xvnc with grep, so I tried the manual method again, this time getting:

    vncext: VNC extension running!
    vncext: Listening for VNC connections on port 5902
    vncext: created VNC server for screen 0
    error opening security policy file /etc/X11/xserver/SecurityPolicy
    FreeFontPath: FPE “/usr/share/fonts/X11/misc” refcount is 2, should be 1; fixing.

    vncviewer localhost:1 now prompts for password but then ReadFromRFBServer: rdr::EndOfStream
    vncviewer localhost:2 vncviewer: ConnectToTcpAddr: connect: Connection refused
    Unable to connect to VNC server”

    And now I’m stuck. I’m running vnc4server so none of your fixes are working. Any advice?

  79. Hi, Tom. Not sure what you mean about vnc4server. That’s the one I was using also. (Not to say everything is the same between your vnc4server and mine.)

    I’m sorry I can’t offer much guidance — most of what I know is written in the post. I’ve rarely used VNC lately and haven’t tried setting it up in 7.10/Gutsy.

    I hope you keep plugging away — I’m sure you’ll get it.

  80. Thanks for this tutorial! I got it to work, now I can acces my desktop ubuntu via my macbook pro! Now if I can figure out a way to control my desktop from outside my network, I will be very happy!

  81. Glad to hear it, Skuli. You’re welcome, and thanks for commenting.

  82. Hello! I love this HowTo! I have been trying to get my Remote Desktop/VNC working for a long time. I haven’t yet…but I am closer. When I run the command vncviewer localhost:1 to test, I get the login window from vncviewer. Then it starts an X11 session but I do not have a login scree :( it is just X sitting there. But I have hope now that I will be able to get it up and running soon. Thanks!

  83. Hi, JayJay! No, thank you. :-) Hope you got everything working ok.

  84. Hi.

    I’m trying to control the local session remotely, for support purposes. IE, take control of the desktop.

    I followed your instructions, which gave me a session, but not the local screen.

    Can these settings be tweaked to do what I need, or am I hunting a different animal.

    Cheers

  85. You may have a much easier time doing this — there is a built-in remote login feature that has the effect of controlling the remote desktop. I’ve only looked at it briefly, but seems to work ok. In 7.10/Gutsy, the settings are in System » Administration » Login Window.

  86. Have you had any luck with Hardy Heron? I followed your tutorial for Gutsy Gibbon, and got everything working.
    Did the upgrade, and everything fell apart. Still could connect, but Gnome went haywire, and everything is extremely slow.

    Any thoughts would be appreciated.

  87. Hi, Michael. I’ve upgraded to 8.04 on my laptop, but haven’t tried using VNC there. Typically the upgrade will ask if you want to keep or overwrite various config files — have you gone back and checked those?

    I don’t use VNC much if at all lately, but maybe I’ll have to see how things are holding up for Hardy and make some updates here if necessary.

  88. I went through all of the config files again. I cannot find any changes (I redid your tutorial just in case).

    If you get a chance to try out VNC on your 8.04 I would appreciate it - I sometimes wonder if it is just me.

  89. THANK YOU.

    I just installed 8.04 but am going on vacation soon so I wanted to be able to work on this machine while I was away. Remote Desktop was being terribly slow and it’s not what I wanted anyway. It’s a shame this is so difficult to do … OpenSUSE makes it really easy. Anyhow, it works now, so thanks!

  90. Hi, Justin — glad to hear it worked on 8.04 for you.

  91. Cool stuph. Works now! thnx!

  92. Thanks for the guide! I have my setup as a VM and disabled GDM from loading on startup to save system resources. After getting this to work, if I stopped GDM (sudo /etc/init.d/gdm stop) to return to terminal then attempted to login with VNC, I got the gray window with just an “X” cursor. After restarting GDM (sudo /etc/init.d/gdm start) I was able to see the window like normal. I used sysv-rc-conf to disable it in the first place so I used it to reload it now on bootup again so VNC will continue working.

  93. Hi, MW — you’re welcome — I’m glad it was helpful for you.

    I’d still like to go through and update everything for 8.04, but it still seems to be relevant for people and I’m just not using VNC much myself now, so updates will have to wait for another day.

  94. Scott,

    Thank you for posting such a useful blog about setting up vnc.

    I spent hours in the past on different os’s getting this to work.

    Having the responses below also helped…especially the tip about restarting gdm if you see a gray screen.

    Cheers!

    - Lex

  95. Hi, Lex — That’s super. Thank *you* for the feedback — I’m amazed at how well this post has held up and happy to hear that it’s still useful.

  96. Still very relevant today (25 Aug 2008). Very helpful and successful on Ubuntu Hardy (Gnome).

    Many thanks for your most excellent assistance. :-)

  97. Excellent! And you’re very welcome.

You can follow any responses to this entry through the
comments feed.

Say Your Say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

By submitting your comment here, you agree to license it under the same Creative Commons Attribution-ShareAlike 3.0 License as the movingtofreedom.org web site. Please see policies for more information about comments and privacy.