User authentication in Apache web server

Apache provides basic user authentication mechanism based on usernames and passwords. The easiestt way to manipulate them is to use a tool called ‘htpasswd’ from the command line interface. Various tools such as control panels use the same tool only that they provide a GUI interface.

This is a short summary how to manipulate users and passwords with ‘htpasswd’:

-Create the users file and add user to it

htpasswd -c /path/to/users/file username

You will prompted to enter password for the username. Beware that if the password file exists it will be overwritten, if not it will be created.

-Modify existing users

htpasswd /path/to/existing/users/file username

This will modify the password for ‘username’

-Create user and password on command line and encrypt it in the password file

htpasswd -mb /path/to/existing/users/file username password

Beware: the password will be echoed in plain text on the command line but encrypted in the password file

Further information can be found at:

http://httpd.apache.org/docs/1.3/programs/htpasswd.html

http://httpd.apache.org/docs/2.0/programs/htpasswd.html

http://httpd.apache.org/docs/1.3/programs/htpasswd.html

http://www.apacheweek.com/features/userauth

Bookmark and Share

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark
tabs-top  banner ad


Leave a Reply