You are currently browsing the category archive for the ‘Linux’ category.

sudo aptitude install wmi-client

Example of usage is;

wmic -U DOMAIN/administrator%password // “Select * from Win32_Service”

Lists all services, the first line it spits back is the fields which you can use this SQL like language  to filter, so to see only the names of the services installed we’d do:

wmic -U DOMAIN/administrator%password // “Select Name from Win32_Service”

Or Name and State:

wmic -U DOMAIN/administrator%password // “Select Name,State from Win32_Service”

Or for just one service in this case the UPS service:

wmic -U DOMAIN/administrator%password // “Select Name,State from Win32_Service where name=’UPS'”

The language for the queries is called WQL and a reference is available here over at MSDN.

Hope this helps, this is only in Hardy as far as I’m aware.


Just a quick post to make public a new library I’ve been working on (based on the initial work of Andre LaBranche). The code is distributed under the LGPL and I hope it proves useful to someone. It was written about a year ago when, to put it plainly, my Python skills where not exactly awesome, so at some stage it’ll be getting a rewrite and tidy up. Anyway to get it head on over to:

Google Code

WARNING: Before doing this bear in mind that if your laptop explodes in a cloud of molten plastic and silicon that I warned you and I take no responsibility… so don’t blame me ! 😉

A Friend of mine was running CentOS on a Thinkpad T43 (this should work on all though) and the fan was running but apparently not enough to stop the laptop dying after a hour or so. Sounds like a hardware issue, but nonetheless here’s a wee hack to get it to run in Maximum Fan Mode and so far has done the trick.

There is a kernel module in CentOS 5 called ibm_acpi, it needs to be loaded with experimental features, so easiest way to do this is to edit (or create, he didn’t have the file initially, so open in vi/nano etc.)


And add the line;

modprobe ibm_acpi experimental=1

This will load the module each time in experimental mode. Dont’ forget to

chmod +x /etc/rc.modules

If it didn’t exist as it’s a script that needs to be run so has to have execute permissions. Next use an editor to open up /etc/rc.local and add the following line to it;

echo 0x2F 0x40 > /proc/acpi/ibm/ecdump

When the laptop reboots it’ll load the ibm_acpi module creating a new directory in /proc containing special files, for instance the fan info file located at /proc/acpi/ibm/fan (you can cat this file and it’ll list the fans RPM and what mode it is in).

What the echo command we entered in ecdump does is switch the fan into “disengaged” mode, which basically tells it to not bother with auto sensing when it should turn on and run in full speed mode instead, which is around the 6000rpm mark as opposed to 3000rpm in normal mode. so in this new disengaged mode you’ll get something like this from using cat on /proc/acpi/ibm/fan

status:         disabled
speed:          6357
commands:       enable, disable

Yes it does say disabled but that’s it’s disengaged mode. If at any point you want to temporarily go back to auto just do the following;

echo 0x2F 0x80 > /proc/acpi/ibm/ecdump

And to permanently leave it in auto mode just remove that line from /etc/rc.local

Hope this helps someone out and it should be relativly simple to port to other distros. Bear in mind that after kernel 2.6.22 ibm_acpi no longer exists and totally new functionality has been built in a thinkpad module, but for more info best off looking on the thinkpad wiki site at:

ThinkPad Wiki

Edit To Add Other Mode Available:

#(fan off – DONT DO THIS !!)

echo 0x2F 0x00 > /proc/acpi/ibm/ecdump

#(low speed)

echo 0x2F 0x02 > /proc/acpi/ibm/ecdump

#(medium speed)

echo 0x2F 0x04 > /proc/acpi/ibm/ecdump

# (maximum speed)

echo 0x2F 0x07 > /proc/acpi/ibm/ecdump

#(automatic – default)

echo 0x2F 0x80 > /proc/acpi/ibm/ecdump


echo 0x2F 0x40 > /proc/acpi/ibm/ecdump

Very quick note, just found a link to get Skype’s API integrated into Kontact so a simple click on a phone number in Kontact’s address book activates Skype. Very Cool ! 🙂

I made one minor change as I have already formatted my KDE numbers to have a plus. Just change this line if you have also:

number = ‘+’ + sys.argv[1]


number = sys.argv[1]

I might tweak this a bit to do it automagically… but then again maybe I won’t get around to it 😉

I’ve been struggling (albeit not spending too much time) working on an issue on a Gutsy Server problem I’ve had. From one day to the next my SSH logins started asking me for a password. I had set up password-less logins with SSH keys.

In the logs I kept getting:

Authentication refused: bad ownership or modes for directory /home/username

It should have been a clue really… I checked and double checked that $HOME/.ssh might not be set to 0700, or the authorized_keys file might not be set to 0600. No joy… But the clue was really in the error. It was the ownership of my entire home directory, which although the owner is me and the group is also my username it apparently wasn’t good enough.

So chmod 700 /home/username fixed it…

Annoyingly easy !

UPDATE: Check no one has added themselves to your group in /etc/group… yep it’s a *special* account used by a couple of us, and one of the guys had added his own account to the group… tut tut 😉

That would explain the “Working From One Day To The Next” scenario !

Read an interesting if somewhat far fetched research article published on the BBC. Aparently RAM can retain data for 10mins to several hours (if cooled to -50c).

The Link to the BBC Article:

To bypass this I hearby suggest to BIOS manufactures (And I put it here in a “prior art and you can’t claim it as a patent”, think “Patent Pending” by Homer in the Simpsons when he notices the ex-con is around for dinner with Marge) add a function where-by the OS at the end of it’s shutdown process can call the BIOS to wipe all RAM to 0s and flip them to 1s a few  times wiping memory. Not being a Hardware designer maybe there is something that would prevent this but I can’t see what it would be.

Maybe something for the OpenBIOS guys to implement ?

I suppose the rule applies, beware of suspicious looking individuals with tanks of liquid nitrogen on thei backs ! 😀

(Usual disclaimer applies: Use this on a test system, I don’t claim this to be bulletproof if you’ve made changes etc. 😉 but it should work ! ie. did for me on a fully running system )

Install cacti via aptitude as per usual, loads of guides out there for that; configure it etc. can even add hosts. It doesn’t break anything, so this can be an upgrade on a current running system.

Download Hardy’s cacti deb from

Install that locally, you’ll then need to follow the upgrade process via the browser again. Be careful if you used cactid rather than the php script you’ll need to make sure it’s not looking for spine (the new cactid name) which hasn’t changed as of yet.I simply modified the path in the config to point at the current cactid binary file.

After  all that, check it’s running, it should be ! Then you can grab the Cacti Plugin Architecture from

Best thing to do here is make a quick backup of /usr/share/cacti/site

cd /usr/share/cacti/

sudo cp -a /usr/share/cacti/site /usr/share/cacti/site_BACKUP

Then untar the  plugin-arch tarball to the /usr/share/cacti/ directory and copy the directory within and the patch file into your /usr/share/cacti/site directory and follow the details on the page to patch them, note do not overwrite files as this totally messes up the changes Ubuntu has made to the Cacti package.

There’s a tiny fix needs to be applied though, edit the file /usr/share/cacti/site/includes/global.php and on line 57 (on mine anyway) and modify it to

$config[‘url_path’] = ‘/cacti/’;

The patching proces changes that to $config[‘url_path’] = ‘/’; which means all the graphics disappears etc. which is obviously not good !

That should be it… one thing to note is so far the CLI tools for cacti are not in the Ubuntu package. Dead simple to add these. Just download the 0.8.7a tarball from and extract it somewhere. Inside it is a cli directory, that can be just copied into the /usr/share/cacti/site folder and you can add graphs, hosts etc. via the CLI tools.

Enjoy… 🙂

Baring any omissions by me (This was done from memory)

How Very Del Trotter 🙂


I get my internet via Neuf Telecom here in France. During a recent upgrade I discovered that my router now had a new totally open/unsecured SSID of “neuf”. Anyone using this can get free internet from my connection. These users are totally walled off from my network (assuming no code problems!) and can do whatever they want. It seems folk in the UK will be getting a taste of this soon.

It does make me wonder, what happens if someone downloads child pornography, breaks into a banks computer or even downloads copywrited material over my connection. Am I liable… hardly !? Is it a sly way for Telcos to protest to the obligation of having to keep records for over a year…..they’d be rendered pretty useless with an open access point.

Anyway it’s a very good idea in my opinion (assuming my neighbour hasn’t got the Police racing to arrest me as I write this), the internet should be as freely/easily accesible by whoever as possible (I’m not condoning illegal practices) although I wish my neighbour had it before I got internet and I could have just leached off of them ! *sigh* 😉

  • IBM’s New Security Spaces Site