Appweb: Lightweight PHP Web Serving

If you’re looking to serve PHP pages in a very low resource environment appweb is worth checking out.

Appweb is a fast embedded webserver that supports php out of the box. It’s open source and they provide binaries for Windows, OS X, Debian and Red Hat as well as source code over here.

In my personal and limited testing appweb has proven to be very fast and stable. The only real problem I’ve had with it is that the PHP module that comes in the box doesn’t have support for things like MySQL. This makes sense for keeping the default install light but presents a problem for running most standard webapps. You can overcome 2this by simply compiling php yourself and replacing the build that comes with appweb.

All in all I would recommend appweb to someone looking for an embedded/extremely lightweight web server that doesn’t skimp on features. The installation process is easy and the community seems to be active and involved. Go check it out for yourself, I’ll be posting some more in depth tutorials on appweb later.

On J.C.R And Man-Computer Symbiosis

This post is dedicated to one of my personal heroes: J.C.R Licklider, an early computer scientist and tech visionary who predicted and ultimately helped to create the Internet and interactive computing as we know them today.

If you’re the kind of person who reads my blog you’re probably also the sort who knows about ARPANET. For the uninformed ARPANET was the predecessor to the modern day internet dreamed up by the Defense Advanced Research Projects Agency and connected through university campuses across the US. It’s the kind of thing that a really annoying AC would post about on Slashdot, but they leave out Lick.

J.C.R was envisioning exactly what I’m doing as I type this back in the late 1950′s. Graphical interfaces, complex networks, and even UNIX variants ( UNIX originally being inspired by MULTICS, a project Lick worked on while at MIT in 1968 ) are just a few of the ideas that he planted the seeds for.

That oft used line by fanboys to repute claims that apple created the GUI: “Xerox PARC did it first! Apple just stole it!” has even less bite when you’ve done your research. Robert Taylor founder of Xerox PARC’s Computer Science Laboratory and Digital Equipment Corporation’s Systems Research Center is quoted as saying “most of the significant advances in computer technology—including the work that my group did at Xerox PARC—were simply extrapolations of Lick’s vision. They were not really new visions of their own. So he was really the father of it all.” Xerox did build the first implementation but even Taylor is quick to admit that the ideas used were simply interpretations of J.C.R’s vision.

Licklider summed up his thoughts on the future of interaction between men and their computers in his paper Man-Computer Symbiosis. It’s really not long at about 6000 characters but it’s an amazing look into the future from the point of view of this 1960′s visionary. It’s marvelous, if you have any interest at all in the history of computing it is absolutely required reading.

So take a while to digest this and please do go fact check. The wikipedia article ( with cited references ) is over here and there are a handful of books on this subject alone. When you come back I think you’ll have a much better understanding of how this all came to be and a newfound respect for this man, the grandfather of it all. At the very least it should provide some new fodder to put your know-it-all geek friends in their places at your next social outing.

Executing Linux System Commands in C

I’m not exactly a systems programmer and I make no claims as to my C prowess. However I was recently needed to automate some tasks on my systems in a secure and fast manner so I turned to a simple C program to execute shell commands for me.

In the most basic terms shell commands can be executed from C with:

system(command_goes_here);

But in my case I wanted to take in an argument and use that variable inside of the system call, which looks more like this:

#include
#include

int main ( int argc, char *argv[] )
{

if ( argc != 2 )
{
printf( “\n\nWrong number of arguments\n” );
}
else
{
char sysstr[100];
sprintf(sysstr,”echo %s”,argv[1]);
system(sysstr);
}
}

That code should function to echo the first argument given to the script when compiled. For me the hard part was finding someone who had just written something similar to what I needed so I could take it apart and learn from it. Hopefully this snippet can help someone else who is on the hunt for a working sample.

Find Duplicate Files on Linux With fdupes

The time comes for every user when you’re faced with a directory full of duplicate files that needs to be cleaned.

Thankfully we have fdupes to solve this problem.

There is a slackbuild for the program as well as packages for many other distros available.

The basic usage consists of:

fdupes directoryname

Also useful are the -r and -R switches which both recurse through directories to find duplicates. There is also a -d switch to delete duplicates with prompting and a -N argument to suppress the prompting and just delete without asking.

That’s it, hopefully you find fdupes as useful as I have!

Some Slack: A Blog Recommendation

Quick post tonight.

I’ve been reading the Slackware Linux blog Some Slack since it started in December. The author seems to be a well versed Slacker ( Dobbs in the header seals the deal ) and has put together some really cool open source game packages recently.

Oh and I’m even on the Slackware blog list over there!

If you’re looking to add another feed to your reader I would consider checking it out. I’ve certainly found it interesting and I’m sure it will only get better as time goes on.

Of Reliability, Complex Systems, and Rocket Ships

Earlier today I was reading Marcus J Raymuns Six Dumbest Ideas in Computer Security ( which is a fabulous editorial on it’s own ) and followed a link to a very old article by R.P. Feynman titled Personal observations on
the reliability of the Shuttle
.

It details Feymans personal observations about the complex systems involved in the space shuttle and how reliability was achieved. It’s not written about modern day computer systems but it’s a great read and the message can be applied elsewhere.

Raymun says of the article “Unless your system was supposed to be hackable then it shouldn’t be hackable.” . This is only one of the really solid pieces of knowledge one can glean from the paper.

If you spend any time managing systems of any complexity this paper is a must read.

Linux and General Security Mailing Lists You Should Be Subscribed To

Over time I’ve subscribed to dozens of different mailing lists in an endless attempt to keep up on the latest security news. Below are a few of the best ones that I would recommend to anyone also trying to stay up to date.

[email protected]
Bugtraq is a very active full disclosure mailing list for discussing vulnerabilities. It’s not Linux only but many of the threads are Linux focused and it’s a great list overall.

[email protected]
Discussion of basic security topics, a great resource for the beginner.

[email protected]
The source for release announcements about everyone’s favourite secure shell, useful to stay up to date with changes in this critical program. Very low volume.

[email protected]
Open source security updates. Discussion of best practices and recent exploits, great active list.

Those four will go a long way in getting general security updates as they happen. Something important to remember is that for any specific application you’re using there is more than likely a corresponding announcement and possibly even security specific mailing list. For example Slackware Linux has a list just for security updates in the form of [email protected] .

Power Down Headless Virtual Box VMs

Quick follow up post to yesterdays “Headless Virtualbox VMS With VBoxHeadless”.

Once you’ve started using VBoxHeadless to run VMs in the background you tend to start spinning up more and more at once. At this point it can become a hassle to log into each VM and issue poweroff when you need to free up resources, save battery life, etc.

VBoxManage is a huge command that covers pretty much everything that one would want to do with a VirtualBox VM from the CLI. Not surprisingly it can accomplish our task quite easily.

VBoxManage controlvm $VM_Name poweroff

Where $VM_Name is either the name that the VM would be displayed in the VirtualBox GUI manager or the UUID of the VM.

I plan on doing quite a long series exploring VirtualBox commands from beginner to advanced level. I hope you’ve enjoyed these quick introductory articles and will stick around as we go through some of the more exotic functions of the VirtualBox suite.

Headless VirtualBox VMs With VBoxHeadless

Recently I’ve found myself spending so much time in and out of VMs that a good way to spin them up in the background with my attention elsewhere was necessary.

Enter VBoxHeadless: it comes with a standard VirtualBox install on Linux to solve exactly this problem.

In a nutshell to start a VM in headless mode you would use:

VBoxHeadless –startvm $VM_Name

$VM_Name in this case being the name it would show up with in the VirtualBox GUI. You can also use the UUID of the VM but for me name is much easier to remember.

This one usage of the command is enough to accomplish 99% of what a normal user wants to do, but there are a few more parameters for things like VRDE and screen capturing as shown in the output of VBoxHeadless below:

[mm 21:51 0]$ VBoxHeadless -h
Oracle VM VirtualBox Headless Interface 4.1.4
(C) 2008-2011 Oracle Corporation
All rights reserved.

VBoxHeadless: error: –height: RTGetOpt: Command line option needs argument.
Usage:
-s, -startvm, –startvm Start given VM (required argument)
-v, -vrde, –vrde on|off|config Enable (default) or disable the VRDE
server or don’t change the setting
-e, -vrdeproperty, –vrdeproperty Set a VRDE property:
“TCP/Ports” – comma-separated list of ports
the VRDE server can bind to. Use a dash between
two port numbers to specify a range
“TCP/Address” – interface IP the VRDE server
will bind to
-c, -capture, –capture Record the VM screen output to a file
-w, –width Frame width when recording
-h, –height Frame height when recording
-r, –bitrate Recording bit rate when recording
-f, –filename File name when recording. The codec
used will be chosen based on the
file extension

That’s it for headless VMs on VirtualBox. Once you decide to leave the GUI in the dust I think you’ll find VirtualBox a much more flexible and easy to use virtualization platform.

Modern Linux Networking Commands: A Blog Recommendation

Let me preface this by saying if you aren’t already reading the Doug Vitale Tech Blog you either don’t know what’s good or are just uninformed. Now that you are informed all excuses are nil.

There is a great post over there titled Deprecated Linux networking commands and their replacements that I cannot recommend enough.

I consider myself a person who keeps up on all the comings and goings of my field but somehow I totally biffed this one. In the article Doug goes into detailed one-to-one mappings from apparently outdated Linux networking commands to their modern replacements. Most of these are now contained in the ip command, including goto commands like ifconfig, netstat and route.

I’m not going to copy paste any of the content over here because you should really go read it for yourself. I for one had no idea the commands that I use every day had become unmaintained or that they had replacements. Now that I can map my previous knowledge over to the ip command I feel like the coolest sysadmin on the block.