Sunday, July 24, 2011

Linux Tutorial - Apache Web Login Authentication:

Linux Tutorial - Apache Web Login Authentication::

Password protection by a single login:

Password files:

  1. Create the directory you want to password protect (example: membersonly)
  2. Create a file /home/domain/public_html/membersonly/.htaccess in that director that looks something like this:
    AuthName "Add your login message here."      
    AuthType Basic      
    AuthUserFile /home/domain/public_html/membersonly/.htpasswd      
    AuthGroupFile /dev/null      
    require user name-of-user                     
    In this case the "name-of-user" is the login name you wish to use for accessing the web site.

  3. Create (or clobber if it already exists) the password file /home/domain/public_html/membersonly/.htpasswd using the program htpasswd:
    htpasswd -c .htpasswd name-of-user

No comments:

Post a Comment