Monthly Archives: November 2010

How to run putty as Local System user

Scenario: you want to run a periodic job, a batch script that will use putty to run something on a remote server. You have created public/private keys so that the script can login to the remote server without having to enter a password and you have tested well that it works.

At this point it’s easy to forget that even with the proper public/private key setup, there will still be a prompt the first time the script runs with some user X. The first time you run the script with user X, putty will ask if you accept the certificate of the remote server. When you accept the certificate, Windows stores that decision in the registry, and from the next time there should be no prompt or popup windows, the setup becomes truly automated.

Typically it is not a good idea to run periodic scripts as regular users, because those only run when the user is logged in. The user Local System can be suitable choice. To ensure the script will work correctly, we need to get the answer to the certificate question into the Windows registry. How to do that?

In the example below we export the relevant registry record of the current user that we tested and confirmed, and insert a step into the batch script to import it right before calling putty, so that this way we circumvent the prompt with the remote server server certificate.

  1. Run regedit
  2. Go to HKEY_CURRENT_USERSoftwareSimonTathamPuTTY
  3. Right click on the entry of  the remote server, it should look something like rsa2@22:the_hostname
  4. Export it to a file (cert_hostname.reg)
  5. In your script, import the registry file before calling putty regedit /S cert_hostname.reg

Note: there may be another alternative, using a putty build that reads such registry settings from files instead of Windows registry.

My netbook replaces the living room PC

I have a server in the storage room. And I used to have a long LAN cable all the way from the big black computer in my living room to the server. That’s a thing of the past now.

Last week I realized I don’t really need any personal stuff on my living room PC, just access to internet, movies and music, possibly from a NAS or a portable drive. And I definitely don’t need a LAN cable across the house. So, I saved all my stuff on the big black box to an external drive and replaced it with my eeePC 1000 and got rid of the ugly LAN cable.

My eeePC 1000 had EasyPeasy OS at the time, and was not great, but it worked. Some movies were slow to play no matter how hard I optimized. At that point I decided to reinstall the OS. I had little expectations, but I wanted to do that anyway to clean up the old one and to simplify the disk partitions (in particular, do not use /dev/sdb which is a damn slow drive…)

So I installed the new Ubuntu 10.10 Maverick Meerkat. And the result is totally awesome! It wasn’t too difficult to make it use the monitor instead of the laptop screen, just had to switch off the laptop screen in the display settings. Other than that, I didn’t have to do any setup. The system looks gorgeous. Terminal windows are translucent by default, but this doesn’t seem to slow down anything. Of course it’s not the fastest system, this is just a netbook dammit, but it really feels like Ubuntu is making the most out of this little thing.

The desktop/window manager was a bit of a surprise, as it is not obvious how to browse the filesystem. But actually, I don’t need to browse the filesystem much, do I? I can live with that, and it’s an interesting approach anyway. And there are pleasant surprises too. Now I’m about to wipe the system on the old black box to prepare for sale so I’m making another Ubuntu boot disk, and the USB creator automatically found the new ISO I just downloaded, a nice touch that saved a few steps for me.

There is one final issue to sort out that has nothing to do with the OS. How do I turn on the power without opening the lid?