Join 3,561 readers in helping fund MetaFilter (Hide)


How do I shutdown my Linux PC by email?
January 11, 2010 1:48 PM   Subscribe

On my Windows machine I used rules in Outlook to do various things such as shutdown my system remotely via email. I have switched to Linux (Mint 8) and would like to be able to do this with my new OS. Unfortunately I have not been able to find an email client that would enable me to execute an application/script/command based on a rule/filter. Thunderbird has filters, but only for sorting emails, not running commands. Any ideas?
posted by Unhyper to Computers & Internet (7 answers total)
 
Not an email client but you could use the Apache James server with fetchmail, which would allow you to execute a "maillet" in Java based on rules. The mail could subsequently be downloaded to a normal mail client.

I'm kinda curious - doesn't this mean that anyone could shut down your system, perhaps with a properly spoofed origin address?
posted by XMLicious at 1:56 PM on January 11, 2010


Linux is more conservative than Windows about mechanisms that would allow someone to execute code from a remote location.

Your closest match with the least work, I think, would be a cron job that uses the mail program (or directly accesses your inbox), and conditionally executes commands.

cron and mail are venerable programs with copious documentation (check out the man pages).

This is not something to undertake lightly though, because if done sloppily it is a huge security risk - email is very easy to forge (including fake headers hiding the sender, the whole deal) and insecure in transit (very easy to grab, alter, whatever). Even if your machine has nothing on it that an attacker may want, someone still wants your computers resources as part of their botnet.
posted by idiopath at 2:02 PM on January 11, 2010


Does it need to be email? SSH would do what you want.

You could look at knock as well
posted by chndrcks at 2:17 PM on January 11, 2010 [1 favorite]


I think chndrcks has the best answer (the ssh one, that is - knock seems pretty sketchy).

Use a web ssh gateway if your remote machine does not have ssh (needs to be said: do not use a web ssh gateway that you are not completely sure of - the java app has full access to whatever you send, and you have to trust the app not to do anything nefarious with the data).
posted by idiopath at 2:23 PM on January 11, 2010


Yeah, ssh is your friend here. You can do anything you want with your system via ssh, securely. Couple it with x11 tunneling and you can run your desktop remotely. Throw in an ssh keypair and you don't even need to worry about password interception, because you will only be passing a username and a hash.

You can run PuTTY off of a USB drive if you need to access the system from a Windows box, otherwise any Mac or Linux system has the command line available. Most smartphones have an ssh client available. I know there are iPhone terminal apps, and I used to use a PuTTY-based app on my Symbian phone...
posted by caution live frogs at 2:31 PM on January 11, 2010


procmail is meant to perform arbitrary actions based on (notoriously syntactically difficult) rules. It's not an email client, per se; it's more of an email preprocessor. If you know Perl, you could do the same with Email::Filter. You'd also have to setuid root the shutdown command.

(I agree with the other posters that it seems a gratuitously large security hole to open, but that's your business.
posted by Zed at 2:38 PM on January 11, 2010 [3 favorites]


Yeah, I came here to recommend procmail as well. There is a fairly steep learning curve but you can do pretty much anything with it.

SSH is the best tool to use, assuming that your workstation is someplace where you can reach it via ssh. You can also do all manner of tunneling with it.
posted by jquinby at 3:10 PM on January 11, 2010


« Older I am trying to revive a BCM200...   |  What's the best way to handle ... Newer »
This thread is closed to new comments.