Shutting down Windows from Linux

I had to do some research on how to remotely shut down a Windows computer from a Linux host and decided to share :-)

My test environment: 

  • Gentoo linux running on my laptop
  • Windows XP SP3 running in a VirtualBox guest

The command (you need Samba installed on your Linux machine):

net rpc shutdown -t 10 -f -C "Remote shutdown initiated" -I 192.168.56.2 -U Erik

Broken down, that becomes:

  • -t 10 to give users 10 seconds to hit Ctrl-S
  • -f to force applications to quit without asking the user to save (so they can't get in the way of the shutdown)
  • -C "Remote shutdown initiated" is the message that should be displayed to any logged-in users
  • -I 192.168.56.2 the IP address at which the machine to shut down is located. In my case, the host-only network adapter
  • -U Erik is my username on the Windows machine. Works also as <hostname>\<username> (don't forget to escape the backslash if your shell requires it!) or as <workgroup>\<username>
  • If you like, you can add -r to reboot the machine instead of shutting it down.

If you don't want to be asked for your password, append it to your username with a % sign, like so: -U <username>%<password>

Of course, with Windows being involved, this doesn't work right out of the box ;-) In my case, after being asked for the password the net rpc command reported "Shutdown of remote machine succeeded". The Windows XP machine didn't shut down. It didn't even show me a message. A little Wireshark magic ended up revealing the error code "WERR_ACCESS_DENIED" being sent across the wire. (note to self: maybe a newer version of samba will actually do something with this error?)

Long story short: the solution is to have file sharing enabled, but to disable simple file sharing. To do so, open Explorer, go to Tools -> Folder options -> View (yes, it's the most logical place to put this </sarcasm>) and uncheck "Use simple file sharing" (all the way at the bottom of the list).

Comments (0)  Permalink

E-mail alerts now work

I finally got around to fixing e-mail alerts. This means that the contact form now actually works, and I'll get notified of comments on posts so I'll know about them and can react to them :-)

Go me!

Comments (0)  Permalink

Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!

I ran into this error while messing around with nagios. Manually playing around with on /var/lib/nagios3/rw/nagios.cmd and its containing directories didn't seem to help much, so I went a-googlin'.

Here is the solution.

In short: (in case that blog goes down and I need it again ;-) ) :

sudo /etc/init.d/nagios3 stop
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
sudo /etc/init.d/nagios3 start

Comments (0)  Permalink

Project 365

OK, I'll admit: I gave up. When I realised that I had been skipping my daily picture for a week or two I decided not to pick it up again - I'd rather end it cleanly than have a gap in the series, followed inevitably by another gap later on and so on.

It was, however, fun while it lasted.

Comments (0)  Permalink

Project 365

After three months I'm almost surprised to say that I still didn't give up my project 365. Today's picture: I read a short article on macro photography with a point & shoot digital camera and decided to give it a try. It worked :-)

Comments (1)  Permalink

Pictures

 When taking the bus to the train station after work today I decided to get off a few stops early go go and check out a local graveyard. I'm rather pleased with some of the pictures I made there, so I put them in a gallery...

Comments (0)  Permalink

Palm Pre in Belgie met Mobile Vikings

Eerst en vooral: credit voor deze methode gaat naar Andreas op de TreoCentral forums. Hier is het topic waar ik de info heb gevonden.

Ik heb een unlocked Palm Pre gekocht in Nederland. Jammer genoeg moet het ding, voordat het echt bruikbaar is, zichzelf eerst activeren via het data netwerk van je provider. Laat ik net overgeschakeld zijn naar Mobile Vikings, een provider die de Pre niet kent.

Oeps.

Internet to the rescue!

In WebOS 1.3 zou het mogelijk zijn om in de activatiewizard je eigen data settings in te geven. Upgraden die handel!

  • Eerst en vooral: het toestel komt oorspronkelijk uit Duitsland (het QWERTZ toetsenbord is een grote hint ;-) ), dus ik heb de Duitse WebOS Doctor gedownload.
  • Om de Pre in WebOS Doctor modus te zetten:
    • Schakel het toestel volledig uit
    • Steek de stekker in het stopcontact en de mini USB connector in de Pre. Wacht met het aansluiten van de USB poort op de stekker!
    • Hou, terwijl je de USB poort op de stekker aansluit, de "volume omhoog" knop ingedrukt. Je zal een USB logo zien verschijnen op de Pre.
    • Dit is het moment om de USB stekker weer uit te trekken en het ding op je laptop aan te sluiten.
    • Start WebOS doctor op en volg de wizard (ik heb voor alle veiligheid Duits gekozen, weet niet hoeveel het uitmaakt). Hij zal je Pre herkennen en beginnen upgraden.
  • Eens de wizard voltooid is zal je Pre herstarten en de setup wizard opnieuw doorlopen. Op het punt waar het creëren van een nieuwe account faalt zal je nu de mogelijkheid hebben om je eigen data settings in te geven. Dat is alles, je Pre werkt nu.
Comments (0)  Permalink

Back!

 And that's that. The people at FreeFlux were kind enough to provide me with an export of both the database and the files of my account there, I got my domain names sorted out, managed to get the import done properly et voila, I'm personally hosting my blog. 

w00t!

Also, I caught up with posting my project365 pictures. Go me!

Comments (1)  Permalink

Project 365

Oops ... hadn't taken into account that pictures take up diskspace. And that my diskspace on this account is running towards "full". I'm going to see what I can do about that (either host it myself, or work something out with the Freeflux people), but in the meantime I'll stop uploading pictures. I will keep making them, however!

Comments (1)  Permalink

PageUp to irssi in Terminal (OSX)

 Note to self: sending a PageUp to irssi running in an SSH session in Terminal on OSX Snow Leopard (as opposed to sending it to Terminal itself) is done via fn+shift+up.

That is all.

Comments (0)  Permalink
Next1-10/44