Busybox httpd with basic auth

For very simple websites, nothing beats running ‘busybox httpd’.

To build it, download the latest source from: https://busybox.net/downloads/

To compile:

make defconfig
make

To run with basic authentication:

  1. Find out the hash of the password you want to use, for example, if
    you want to use the password ‘secret’:

    $ busybox httpd -m secret
    $1$gDqyrCR.$6MSG2JC9CBWRNypWVfuC81
  2. Add the login information to your httpd.conf file. For example, to use user ‘fred’:
    echo '/:fred:$1$gDqyrCR.$6MSG2JC9CBWRNypWVfuC81' > httpd.conf
  3. Start busybox httpd as follows:
    busybox httpd -v -f -p 5005 -r "Identify yourself:" -c httpd.conf

    Options used:
    -v: be verbose
    -f: stay in foreground (don’t daemonize)
    -p: port number
    -r: authentication realm (i.e. string you want to show the users)
    -c: configuration file

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s