I administer a home server, and sometimes when I'm out, I need to execute some simple commands on the server. 3G + SSH is not an option because it's too expensive from my phone (here in Argentina). It is easier to send an SMS to my mail account.

I want to fetch the mails I send to my server, and process the text surrounded by ** as bash commands.

What approach would you recommend?

  • 4
    This is opening a huge security hole. You should only process messages properly signed with a GPG key or otherwise encrypted by you.
    – Caleb
    Jun 9, 2011 at 8:20
  • 2
    It's necessary, but not enough, to sign the mails. You also need to protect against replay attacks. This looks nontrivial if you can't have any back-and-forth. Jun 9, 2011 at 23:34
  • Well, looks like sending mail is a very insecure approach and hard to make it safe. I'll see what to do.
    – Tomas
    Jun 10, 2011 at 4:09

3 Answers 3


I'd recommend you install procmail or some other mail processor. You can configure it so everything from you, with a subject line of a certain magical password that only you know will pass the contents to a script (which you could then execute).

But... you're opening a huge security hole so it's unwise to do this as it's an unencrypted form of remote access to your server.


A lot has changed since this question was asked, but possibly this answer provides a helpful approach.

The simple mail processing you're asking about opens a security hole, as noted by others. But you could patch that hole with an additional confirmation step.

In the basic version, after your server receives your instructions mail, it would then send a confirmation code to your mail account (lets keep its generation another topic), for which it would then wait to be echoed by you. Only then would it proceed with the instructions you had sent in the first mail.

This solution can have enriched variations. One part of them would be operations on the code itself. Another way to improve the safety is to open a new communication channel. You might connect another mobile device to the server, which would send to you the authorisation code as an SMS. This way you would also get informed in the event of someone trying to send instructions to your server.


I'm a major developer of a new commercial tool Ales-U from alessoft.com which helps you to control servers/application using email. This tool is based on proprietary protocol which provides common method for identity verification of the person sending execution commands as well as for validation of the email headers. The tool controls all the operations on a Server Side and restricts the user to predefined set of actions he allowed to do. It doesn't require to download mobile application and can work from any email client. The protocol acts as a "status machine" which means that for each particular "Status" there is well defined set of messages the user is allowed to send. For example, for a WAIT status, the only "Start Dialog" command will be recognized. It can be used as a complementary tool for Mobile SSH client or other applications providing similar "remote control" solutions. To see more, you can visit the download area of the site and obtain documentation and presentation files. Actually I'm using Ales-U to contorl my server remotely almost every day, since I provide the System Administration, DBA and application support services to multiple companies and Ales-U helps me to easy control applications on my server when I'm far away...


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .