How to Password Protect your Web Page
 
Using the command 'mkwebpass' on your Linux account
  • To password protect a web page you must log in to your Linux account. You can do this via a shell session from Windows using an SSH client such as putty or Secure Shell SSH. You can also log in directly to a Linux workstation in the math department, or use an X-Window system from within Windows such as Xming or X-Win32.
  • Once logged into your Linux account, move to the directory that you wish to protect, e.g., cd ~/public_html/privatefiles
  • Now type the command, mkwebpass at the prompt.
  • You will be prompted to type in a username and password combination. Do not use your math account username and password.
  • The mkwebpass script will create a .htaccess and .htpasswd file in your current directory.
  • To change the username password combination, run mkwebpass again.
  • To disable password protection, remove the two files, e.g., rm ~/public_html/privatefiles/{.htaccess,.htpasswd}
  • When enabling password protection on a published web directory, be sure to test the protection. Open your browser and navigate to the directory, e.g., enter the URL http://math.ucla.edu/~user/privatefiles in your browser. A pop-up window for authentication should appear.


UCLA Department of Mathematics                          Search     Home