Controlling your Linux Machine Using just a Text Message

Here we Present our Series, Hear from the Author

What is Server Text ?

In short, server-text is a program that allows users to run commands on their servers or computers via SMS. In simple, you can think of it as full-fledge shell but commands run via text message. This program runs by users adding their number with SMS gateway and their email address. When the script runs, users can write commands through their phone messaging and get an output. We highly recommend never to run this on production servers as there are a series of security issues related to this program

From this article, you will learn about our design process, implementation, and intent of this project.
You can see our repository here.

Why We Built This?

Two years ago we came across a video where a guy codes using text messages as this video turned out to be the inspiration for this program and then we decided to build this project. When building this project we had a specific use case in mind, where users could get information in regards to their server. For example, they could find out how much CPU was being used on a Rasberry Pi just over text. Our intention behind this project was to give the user a way to access information in regards to their server in a different way and easier way just by texting and that’s one of the reasons why we built this program.


You can view installation demo here Note: I use python version 3.9 but 3.6 is being widely used

  • Before you clone the repo make sure you have python3 and pipenv installed on your machine.You can always verify python by running python3 --version on commandline and if you don’t have pipenv installed you can refer to the docs
  • Once you have python and pipenv installed now you can clone the repo git clone
  • Now cd server-text/ and run pipenv shell to activate the virtual environment and pipenv install to install the dependencies.
  • Once you have installed the dependencies before you run the script make sure to populate the script with your email,pas ,number from which you will be sending texts from, and imap server of your email provider

How it Works and Implementation

As we already built a simple text message project which allowed you to send text messages from the command line, we followed the similar approach of using SMS messaging with email to facilitate running commands on our server from our phones. We built the aplication using Flask so when a user runs a command he can view his output in HTML format.

Before the users can start the script, they need to enter their information.

mail = '' # Email - Where you will be receiving texts sent from phone
pas = '<email_pass>' # Email password
number = '+1[number]@SMS_GATEWAY' # Your phone number with SMS_Gateway
imap_server = '<your_email_provider_imap'

Now start the server by running the command python3 the server is waiting for the user’s message. Writing a simple command in my phone message ls -la as a text message while my server is running, it will send this message to the email I entered. The script will look for the message, and check if the message was sent by the number added. If this is true, the server will execute this command on the server. With the response, we send the command and turn it into HTML using the ANSI2HTML library which will then be rendered by the flask application to the user’s screen.

Moving Forward

As a disclaimer, our program is by no means finished or fully developed. We know there are various security flaws, and we are researching the best means to properly address them. From our use case, the commands that we thought we wanted initially were read-only and wouldn’t ever change the server.

Since this was a very controversal project, we learned a lot from the feedback we got from the community. As beginners into the open source community, we want to continue to dive deep into creating new projects for the community and to learn from others.

About MTDevs

MTDevs is an open source organization that focuses on writing open source software. The two founders are Muhammad Raza based in New York City, and Taichen Rose based in Bellingham, Washington. You can read more about us here


If You find it interesting!! we would really like to hear from you.

Ping us at Instagram/@the.blur.code


Thanks for reading!! 

Happy Coding

2 thoughts on “Controlling your Linux Machine Using just a Text Message

Leave a Reply

Your email address will not be published. Required fields are marked *

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top
Hey, wait!

Before you dive into the exciting Article, wanna join our newsletter list, We promise we will not spam