Shutting down a Ubuntu server remotely from Windows?

Dave Hall ubuntu at skwashd.com
Sun Nov 18 11:38:14 GMT 2007


Hi Tom,

On Sat, 2007-11-17 at 12:19 +1030, Tom Schinckel wrote:
> Okay, so I've turned an old box into a Ubuntu file server for the old 
> man to keep his dodgey 80's music and other "important" files of his 
> which he can access via Samba etc. on his XP desktop. Anyway, the 
> problem I'm having is that he doesn't want it running 24-7, thus I'd 
> like a way of remotely turning the thing off. Currently, the only way to 
> do it is too ssh in and go sudo shutdown -P now, but that's a bit 
> complicated for him, so he'd prefer if he could just click an icon on 
> the desktop or something. I'm not to concerned if it's insecure, because 
> everything's sitting behind a firewall.
> 
> Any ideas?

You could try the following.

* On the Linux box Open up /etc/services in a text editor 
  (try "sudo nano /etc/services")

* Find a spare portnumber such as 4285 - not called <port>

* Add the bottom of /etc/services add the following
  remotepoweroff    <port>/tcp

* Save the file and exit your text editor

* Now open /etc/inetd.conf in your text editor

* At the end of the file add the following entry
  remotepoweroff stream tcp nowait root /sbin/poweroff

* Save the file and exit the text editor

* Finally run "sudo /etc/init.d/inetd restart"

On the windows box just create a shortcut on the desktop similar to this

Name: Shutdown Server
Command: telnet ip.of.server <port>

Now click on the icon and wait for the box to power down :)

Good luck.

Cheers

Dave




More information about the ubuntu-au mailing list