n900 Tricks: Remote Control with VNC / x11vnc

Feb 4th, 2010

The n900 is a geek’s dream phone, there’s no doubt about that. I had a n800 before, so it’s not surprising that within the first week of having my new gadget I’ve started to try to recreate some of the tricks I used to play with. Previously I was just experimenting, whereas this time I’m trying to bring more convenience into my life…

So, my first trick (after playing with installing a load of software from the application catalogues and a few things from Ovi Store) was to get set up so that I could do things with my phone from my PC without letting go of my keyboard and mouse. On my previous Nokia phones, I had some success with RemoteS60 once upon a time (though it always seemed a bit unreliable) to view and interact with my phone’s screen, but that wasn’t free to use. Nokia’s PC Suite (and Ovi Suite) software offered a range of features for working with contacts, calendars, text messages and generally moving content to and fro, but none of that is readily available for the N900…

So I turned my attention to VNC, a technology for interacting with other computers’ desktops that is great for its cross platform compatibility, but has somewhat fallen in popularity with the advent of Microsoft’s Remote Desktop, and various other third party technical support solutions to remote control for support purposes.

I was glad to see that everything I needed was already available, so here’s what I did to get it all set up, with a little oddity to be aware of noted at the end.

Note that in order to get everything working, root access is needed. This is easily achieved by downloading the gainroot package and then using sudo gainroot in a terminal window.

First, I downloaded a VNC Viewer for my PC (TightVNC was an old favourite of mine, and offers a nicer UI than the ‘official’ VNC client) and downloaded the x11vnc package on the n900, which is just available from the extras repository.

I grabbed a widget for my desktop so I could have my current IP address visible – I tend to hop between different wifi networks at home and work, and don’t have the benefits of a consistent IP address in either location, so having it visible quickly helps.

Now, at this point everything does just work. I can run x11vnc on my device and connect to it with VNC Viewer, and find myself happily remote controlling my N900. However, it’s not incredibly secure – anyone that guesses my IP address can do the same. So, here’s how to add a password for some basic security:

Open a Terminal window, and get root access. Personally, I have SSH installed and opted to do this in a Putty window from my PC.

x11vnc -storepasswd

This doesn’t actually launch x11vnc, but instead prompts for a password. This is the password that will be needed every time VNC Viewer connects.

However, this stores the resulting password in a directory called .vnc in the root user’s home directory. Time to move it somewhere more useful, with the following command:

cp .vnc/passwd /home/user/.vnc/

I’m not sure whether it is necessarily, but I also threw in a chown user:users on the passwd file to ensure it was owned by the ‘user’ account.

By default, x11vnc doesn’t know to use the password that’s been created so, still armed with the root terminal, a small change needs to be made elsewhere. Time for the following to get where we need to be:

cd /usr/share/applications/hildon/

The file we want to edit is x11vnc.desktop. The n900 comes with vi installed for terminal-based text editing, but others exist – leafpad is quite popular I hear, though I stuck my old friend nano onto my N900 from the fremantle/tools repository (instructions part way down this forum post).

We find the line that reads:

Exec=/usr/bin/x11vnc

and change it to:

Exec=/usr/bin/x11vnc -usepw -remap Return-KP_Enter

There’s an extra bit on the end there designed to remap the way the Return key works from VNC. By default, it triggers the on-screen keyboard (if enabled), and so this remapping changes the behaviour so that Return sends an Enter keycode (the key on the numpad of most keyboards) so get the expected behaviour.

And now we’re set to go. Start x11vnc on the device, and VNC Viewer can, after the password has been entered, connect to the device’s IP address. It’s worth noting that x11vnc only accepts a single session before closing. To make it remain open, a -forever tag needs to be added to the command line above, though I opted against this personally.

However, I found one small problem with x11vnc (I’m not sure if others have had similar issues). After connecting to it, a process running on my n900 seems to go crazy, maxing out the CPU (and draining battery life rapidly).

I find the process by running top from a terminal and looking for /usr/bin/maemo-xinput-sounds at the top. Interestingly, for the first time when writing this article the problem didn’t occur, which makes me wonder whether having the Media Player open in the background prevents it. Either way the problem is resolved by simply using the kill command followed by its process number. This doesn’t seem to have any negative effect on the device, though I tend to reboot my device after using VNC just in case…

And there you have it, remote control of the N900 from a PC – ideal for when you’re hard at work on a full size keyboard and don’t want to context switch your fingers onto a smaller device. It’s not perfect, and if there are issues with VNC not responding to clicks, take a look at the advice from Forum Nokia.

Tags: ,
  1. Miro
    Jan 4th, 2012 at 12:38
    Reply | Quote | #1

    Hi guys,
    Couple of questions but first this is what I did:
    opened x terminal
    sudo gainroot
    x11vnc –storepasswd
    Entered vnc password
    Verified the password
    Write password to /home/user/.vnc/passwd? I typed Y pressed enter
    Then I typed
    x11vnc -forever –usepw

    I also replaced the line that says “Exec=/usr/bin/x11vnc” with “Exec=/usr/bin/x11vnc -usepw”

    My question is: everytime I launch x11vnc through phones menu I am not asked by RealVNC (PC) to type in my password. Also as soon as I shutdown the RealVNC from my PC I have to re-launch x11vnc from my phone. BUT!…if I type in xterm
    sudo gainroot
    x11vnc -forever -usepw
    And then launch RealVNC (pc) I get asked to type in password before connection and I can shutdown and re-launch VNC from PC as many times as I want without loosing connection with my n900.So what is the use of having x11vnc icon in the n900 menu when I can only use it once per time if you understand my thinking?

    Best regards

  2. renko
    Nov 29th, 2011 at 00:42
    Reply | Quote | #2

    chown user:users appears to be necessary if you restrict connections as ‘root’. Thanks for this.

  3. Bubble
    Nov 10th, 2011 at 00:04
    Reply | Quote | #3

    We’ve been using x11vnc for over a year now accessing serveral of our company’s debian servers running virtualbox instances. Another piece of software I couldn’t live without, haha..

    One thing that I’m a little puzzled about is how to change the x11vnc password when x11vnc is already running. I’m getting a ‘XOpenDisplay(“:0.0″) failed’ error when I type x11vnc -storepassword. As if it wants to connect twice to the same display.

    I’ve tried the -novncconnet option but it gives me the same error message. Is the only way to log out of my X session, shutdown XDM and start a new session from the console?

    Any other suggestions I can try?

  4. thenoid
    Mar 21st, 2011 at 16:40
    Reply | Quote | #4

    X11VNC is one of those things that, AFTER finding the answers, they look so easy, but BEFORE it is a hell to find alone. Very thank you for posting this.

  5. Achim Elsner
    Apr 25th, 2010 at 12:41
    Reply | Quote | #5

    Hi,

    the advice from Forum Nokia seems to be unusable to me. They say you have to edit a file “/etc/init.d/x-server” which in fact doesn’t exist om my N900.

  6. Andy
    Mar 19th, 2010 at 13:39
    Reply | Quote | #6

    It most likely isn’t crashing. There is no user interface to x11vnc – it runs in the background. Launching it a second time closes the process I believe.

  7. Ash
    Feb 18th, 2010 at 21:28
    Reply | Quote | #7

    Hi mate, I have a problem with X11VNC. I installed it today but everytime i click on it to start it, it just does the circley processing thing and then it closes.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes