Personal website - Password protection

Password protected web pages are exactly what they sound like. They require a user to enter credentials before allowing access to the protected content.

How to create password protected web pages

If you're reading this, then you manage your own website and are comfortable with navigating and manipulating the filesystem via a command line interface. You also have an understanding of file permissions on a webserver.

Example

Suppose your username on the Physics webserver is aaaa. You need to create a file (in the directory that needs password protection) called .htaccess with the following content:

AuthType Basic
AuthName "Test password"
AuthUserFile /home/aaaa/path/to/pw
Require user testuser

Everyone who needs to access the protected webpages will also need to have read access to the .htaccess in the protected folder. In this example, anyone that needs to access the webpages under this protection will be asked to authenticate as user testuser.

In the above .htaccess example, credentials will be checked against the file /home/aaaa/path/to/pw. So you need to make sure this file exists and is in the proper format. You can create this file by running a command such as: 

htpasswd -c /home/aaaa/path/to/pw testuser