# How to restrict access to a web page

• First create an empty file .htpasswd in your home directory. Make it world-readable, permissions 644.
• To restrict access to a directory DIR lying in your webspace ~/public_html, you will need to create a short file .htaccess, one in each DIR you wish to restrict access to. The contents of .htaccess should be
AuthUserFile ~/.htpasswd
AuthName "...private web site..."
AuthType Basic

require user


• where is a space-separated list of users, and ~ above should replaced by your exact home directory, the output of the command "echo ~", and AuthName is any descriptive phrase. Your home directory is of the form /usr/home/?/???/tue?????, see this page.
• Different DIRs may have different .htaccess files and thus different restrictions. Of course, restrictions are inherited by subdirectories. All .htaccess files must be world-readable.
• All users must have passwords, listed in the .htpasswd file. Users are added, one at a time, to an .htpasswd file by typing, in a shell,
htpasswd2 ~/.htpasswd user1