Web server (thttpd)

ID #1044

Password protection?

Note: this howto applies for thttpd web server only. This is the stock web server on FREESCO as well as the server for the web control panel.

Use the command htpasswd to create a password file in the directory of your web page, and add users and/or change their password. htpasswd creates a hidden file called .htpasswd, which the web server reads to decide access rights.

When you first create that password file, you use the -c option as you add the first user. Say its 'john' with a password of '123', under your main /www directory.

cd /www
htpasswd -c .htpasswd john

then enter his password. This has created a new password file. For further users, just leave out the -c option. You can also change the password of an existing user the same way. To delete users, you need to load the .htpasswd file with edit and manually delete the line for that user.

The password applies to all html and other files within the same directory, but *not* at higher or lower levels. So for example you might have a main page which everyone could see, and an mp3 subdirectory with a password. This is how the web admin works - the /wwa directory allows everyone to access it, and its just an index.html. When you click on the link its trying to access a page under the cgi directory - which has a password file in it, hence the reason it asks for a password.

Any directory without a .htpasswd file allows everyone to access it.The .htpasswd file is hidden, so if you're trying to list it you'll need to use ls -al

Last update: 2004-10-13 11:17
Author: Dingetje
Revision: 1.0

Print this record Print this record
Send to a friend Send to a friend
Show this as PDF file Show this as PDF file
Export as XML-File Export as XML-File

Please rate this entry:

Average rating: 5 from 5 (1 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry