Picture of Simple linux commands from a web page.
Screenshot-Bash CGI - Mozilla Firefox-11.png
There had to be a way to do simple commands for linux without going to the command line. The neat part to this project is that you can so easily expand it yourself.  Need a directory listing. No problem. Need to know how the disk space is doing. No problem. This simple project will probably expand to a whole management system eventually. But in the mean time, here is just the basic structure which you can easily expand on. Also see

Note: if you are on a terminal that does not have a terminal client, this project is a real lifesaver. This project makes it real easy for me to use a touchpad and check on my servers. No special client software necessary. Also this could be very easily adapted for the Apple Macintosh systems also since it is allegedly bsd based (a cousin of linux). Yes, control your "Mac" from a web page.

If you like this instructable, you might like this one also:
Remove these adsRemove these ads by Signing Up

Step 1: What's needed:

Picture of What's needed:
Human with a basic understanding of BASH (Bourne again shell).

Computer running Apache or other web server that supports the CGI (Common gateway interface).
  A Lamp (linux, apache, mysql, and php) server would be a good start.

Step 2: Extra program needed.

Picture of Extra program needed.
We need to create a simple program to list users for use with the system. So you need to create a file called lsuser with a text editor such as nano, vim, or whatever.

# lsuser - list users
# Assignments
# --------------------------------
# end assignments

# Data input
while read line
do echo $line | cut -d: -f1
done < $datafile

Once the file is created we need to make it executable.

$ chmod +x lsuser

The we need to copy it to the usr program directory.

$ sudo cp lsuser /usr/bin/.

lsuser.txt272 bytes
wdmc854 months ago

I don't have access to /var/www/cgi-bin/ when I try to access it through my browser and when I place the file elsewhere, it displays it as plain text. How can I fix this?

Computothought (author)  wdmc854 months ago

I know I responded to this. replay was missing. You need to make sure that the .txt extention is not used. secondly, you need to make sure the cgi is set up right. Do not know your setup, so it is hard to suggest anything. Also check your permissions.

-rwxr-xr-x 1 www-data www-data 3729 Jun 2 14:53 bashcgi1.cgi

Computothought (author)  wdmc854 months ago

Do not know which server you are using. You will want to go and check your cgi is installed correctly with correct permissions. Hint: look at the apache.conf file.