Remote control you PC from an ipad

 I have a laptop that I uses every day. But some time I would like sit in the sofa and do things on the computer, or perhaps be in a meeting at work in a conference room and look up something on my computer quickly. And that without having to carry around my computer all the time. And I always have my iPad with me, well most of the time any way. So I started to play with x11vnc that will give and vnc connection to me normal X terminal. And when I got a bluetoth keyboard to my ipad its even better.

Installing x11vnc

The first thing you have to do is ninstalling x11vnc. You do that by the normal apt-get install command;

That will give you the x11vnc command that you need to run a remote connection. To be able to set up the server with some level of security you will need to have the vncpasswd command also and that is suplied with the vnc4server package so you need to install that also;

Now you are ready to starting the work. First we need to set a password to be used to connect to the server. You will do this with the vncpasswd command. Run;

And you will get prompted for a passwod and it will store this in the .vnc/passwd file. Be where that its not really encrypted, just obfuscated, so dont use your normal password for it.

Now you can start x11vnc to get it going. Do this by:

The parameters will do the following:

  • -usepw tells the vncserver to use the password set by vncpasswd.
  • -display :0 tells what display to connect to
  • -nodpms tellls the server to ignore dpms – kdesktop has a known problem with its screensaver and vnc.
  • -noxdamage do not use xdamage extensions – i find that this speeds up the rendering – you mileage might vary.
  • -forewer continue to run after the connection is closed.
  • -localhost only listen to connections from localhost – has to be used with ssh tunneling.

Now you can connect to the server from another machine with a vncviewer (but remember to not use -localhost if you want to test that).

vncviewer on the iPad

Now to the iPad. There are a number of programs that gives you a vncviewer capability on the iPad. I have uuse issh for a long time, and that is as far I think, the best ssh program for the ipad. It has a vncviwer part also and it works but I have had some problems. The mouse pointer gets a slight position error and that is very anoying. Threre are some programms, like vncviewer that is free and does a good job, but I whanted some that can give me the security I whant. And iTeleport is the one that I use. The other one that is as good as iTeleport is screen vnc and that has the benefit that it can use ssh keys and store them.

Both will do ssh tunnels and work as well as I can see. With similar speed as far as i can judge.  So it more up to you and what interface you like. And I prefer iTeleport.

I will go thou setup of iTeleport and sceen vnc apps on another post.

And now security

First the connection.

The vnc protocol itself is not bullet proof and can be listen to, so we need to do something about that. The easiest way it to only do the vncviewer thou a ssh tunnel. And both iTeleport and screen vnc suports this.

This is fairly easy to do on the server side – just add the -localhost option and the server will only accept connections from localhost, so you have to connect wvia and ssh tunnel.

If you want to connect from alinux machine use:

And then in another window:

And now you are connected.

Turning off the screen and keyboard

The next problem is that is you are using this to remotly controll you laptop on you desk, someone could watch you screen and see what you are doing, and perhapes even mess with you mouse and keyboard.

This can be avoided by turning off you mouse and keyboard and torn off the power to you screen while you are connected over vnc. TO torn on and off the screen you need the command vbetool – this command will talk to the bios and torn of on of the screen on a very low level, and the screensave and dpms commands that x usually works will be overridden. vbetool need to be run by root so we need to fix that. If you dont have that installed do this to install it:

We will add one line to the sudoers file so that you can run vbetool command without password. Use the command:

and add the lines:

And replase user with you login name.

Uou can test that it works with the command:

I have created 2 small script in my bin directory that will torn off the console  when you login as well as turing off the mice and keyboard. And anotherone that will turn on the screen and keyboard again, and set kerboard repeat off (x11vnc seems to turn that off for me) and also turn on the screen save, so that no one can get to my computer in the mean time between me leaving a meeting and getting back to the laptop. Here they are.

console-off

console-on

To find out what the mouse and keyboard you have is called you can run the command xinput -list.

And now we need to chan x11cnv to invoke this on login and out. And there are flags for this. -afteraccept and -gone. SO the full command that will turn off the screen and then turn it on after the vnc session has gone away is:

I use the afteraccept flag as i want the screen to be disabled after a successful connect and not just because someone connects.

Start x11vnc automatically when you login

The only thing left now is to make x11vnc to start when you login.

Create a autostartscript in .kde/Autostart – i celled it x11vnc.sh:

The -bg flags tells cx11vnc to go into background mode.

And make shiure that the script is runnable:

And now x11vnc should start automatc when you login.

One thought on “Remote control you PC from an ipad

  1. Pingback: A Linux User in a Windows World » Blog Archive » Vnc viewers on iPad

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.