Monday, June 6, 2011

sshd guide for N900 by droll

This is a guide on how you can maximize the utility of the N900 by boosting its performance with a full blown PC :) The general idea is simple - use the N900 to remotely connect to a PC to do work. There are a few problems:

  1. Doing serious work on the N900 over long periods of time is tiring - especially entering text.
  2. Remotely connecting to a PC must meet a few objectives - fast screen refresh, and secure communications.

In this guide, I will show you how to achieve the above.

  1. Install the SSH Client package from the repositories. You can also install the SSH Server + Client package if you want but the server will not be used. We will use the ssh protocol to achieve secure communications.
  2. Install the extmou and extkbd packages as well. These will allow you to use the N900 with a bluetooth keyboard and bluetooth mouse - greatly enhancing the experience of working on the N900 for long periods of time.
  3. In my case, I use the N900 remotely, and I have an unlimited 3G data plan. So I leave the laptop at home connected to broadband while I remotely connect using my N900. My laptop is thus behind a wireless router and broadband modem - meaning it's IP is NAT-ed. To expose the laptop to the internet, a few things are required. First, you need to configure your internet facing router to perform port forwarding.
  4. The standard port for ssh is TCP, 22. You need to forward port 22 from the external interface to your laptop's IP. The instructions will vary depending on your router. You can probably google it to find instructions.
  5. Next, discover your external (internet-facing) IP address. You can Google for sites that will help you discover this with "what's my IP address" keywords.
  6. If you want, you can register this IP with a dynamic dns service. There are a few free ones on the internet. I use dlinkddns.com since my router is a Dlink model and it has built-in support for dlinkddns.com service.
  7. Find and install a ssh server package for your laptop. Since I run windows, I use freesshd. There are instructions on the freesshd website on how to set this up.
  8. Once that's done, you are ready to test your first connection. On your N900, open x-term and type in "ssh -L 3389:localhost:3389 abc@my-name.dlinkddns.com". You should replace "abc" with the user name configured in freesshd. You should also replace "my-name.dlinkddns.com" with the domain name you registered on dlinkddns. If you are not using a dynamic dns service, you can replace it with your external (internet-facing) IP dadress which you discovered in step #5.
  9. If all goes well, you should be prompted to add the RSA key of the server to your N900's ssh repository. Go ahead and confirm it. Then you will be prompted for a password. Enter the password. This is the password for "abc" user that you configured in freesshd.
  10. By default, freesshd configures cmd.exe as the default interface after you negotiate a ssh connection. Therefore, you should see the Windows command prompt in your x-term. You can type commands like you were seated in front of your laptop.
  11. Once this works, you can disconnect by typing "exit" and ENTER. You should then install the rdesktop package from the repositories. This will allow you to use the RDP protocol to connect to your desktop. This is WAY FASTER than using VNC (and more compatible than X11 on Windows anyway). So we will use it.
  12. Re-establish your ssh connection (see step #8). This time around, you won't be prompted to add the keys, but you will get the password prompt.
  13. Once you are connected, launch rdesktop on your N900. Where you key in the host for connecting to, enter "localhost". Enter a user name and password for connecting via RDP. This will be an account that exists under Windows (different from your freesshd account).
  14. And voila! You should see your desktop!
  15. The next step is to configure your bluetooth keyboard and bluetooth mouse. This is relatively reasy.
  16. Pair your bluetooth keyboard like you would pair any normal bluetooth device. Do the same with the mouse.
  17. That's it. You shouldn't need to do any additional configuration. The keyboard should work with the extkbd package and the mouse with the extmou package. The only catch with the keyboard is that the key mappings might not be right. In this case, go to your Settings app (on the N900) and you should see a new entry in there for external keyboard support. Launch it and pick the appropriate keyboard layout. The Generic xxxx layouts are the ones I find that work best.

Happy computing!

7 comments:

  1. 2 things:
    1. Don't use port 22 on your router unless you want to invite script kiddies and crackers on your ISP to find you and attempt to root you. Choose a different port and then forward it internally to 22.
    2. I think you are missing the "-L" part of your RDP tunnel in your SSH command.

    ReplyDelete
  2. yes, you are right. there is one spelling error in the guide too. i'll probably let ajack know about the error. thanks for pointing it out.

    the exact command should be

    ssh -L 3389:localhost:3389 @abc.myhost.com -p
    where "-p " can be omitted if you use the default port 22.

    i use a different port than 22 on my configuration. however, a script kiddie could also do a port scan on your IP and discover the ssh daemon running. to minimize this, disable ICMP responses on your router so that your IP looks like a "dead IP".

    ReplyDelete
  3. oops, got chopped off.

    the command should be:

    ssh -L 3389:localhost:3389 (username)@abc.myhost.com -p (portnum)
    where "-p (portnum)" can be omitted if you use the default port 22.

    will give ajack a short text msg after this.

    ReplyDelete
  4. also, it seems the rdesktop package is no longer being maintained. someone created a fork called freerdp. that one is alive and kicking!

    you can find the package here:
    http://repository.maemo.org/extras-devel/pool/fremantle/free/f/freerdp

    i have not tried it personally (will do so when i get the time) but i think the X11 package should be the correct one:
    http://repository.maemo.org/extras-devel/pool/fremantle/free/f/freerdp/freerdp-x11_0.8.2-2maemo1_armel.deb

    dependencies for the package can be found here http://maemo.org/packages/package_instance/view/fremantle_extras-devel _free_armel/freerdp-x11/0.8.2-2maemo1/

    ReplyDelete
  5. also, some people might not like the fact that the RDP session fonts look really tiny on the n900 (can't help it when you have such a gorgeous screen hehehe).

    two options
    1. plug it into a TV.
    2. get one of these http://shop.ebay.co.uk/i.html?_nkw=screen+magnifier (dig around and you might find a magnifier that fits the n900)

    ReplyDelete
  6. Fixed... :)

    If you installed the freerdp package, to launch it on your N900, open a terminal shell and run:

    xfreerdp

    It will display the various options you need to get it to connect successfully and the IP or URI address should always be last!

    ReplyDelete
  7. Nice blog great information.

    videocon reacharge
    Videocon Telecom, the next-generation GSM mobile service network is the telecom arm of the $10 billion Videocon Group. The company has partnered with global technology leaders to create a robust infrastructure featuring future ready mobile technologies. Powered by the most advanced GSM-EDGE network, Videocon Telecom aims to redefine the Indian mobile telecommunications industry by leveraging a combination of the parent company’s strong brand recall and retail reach with a spirit of innovation and customer centricity. Videocon endeavours to transform the life of every Indian consumer by changing the very paradigm of the way he or she communicates.

    ReplyDelete