ONID - Protect Personal Web Pages with HTAccess


  • How do I password-protect my ONID web pages?


  • Oregon State University
  • Student, Employee or Associate
  • ONID Account


These instructions help to protect your ONID drive web pages by applying a password of your choice.

Note: ONID websites are only available to former users who asked to keep their sites. For alternatives, see:


  1. Create a text file named .htaccess with the following contents:
    AuthType Basic
    AuthName "Password Required"
    AuthUserFile /users/{uX}/{a}/{username}/.htpasswd
    require valid-user
  2. Replace {a} with the first letter of your username. This must be lowercase.
  3. Replace {username} with your ONID username.
  4. Replace {uX} with the user group that you are in.
  5. Login using SSH and type "pwd". Using WinSCP you can find this information above the file list of your ONID directory. Lastly, you can guess, there should only be u1 and u2.
  6.   You will need to save this txt doc as .htaccess, or so that the name is blank, and the file extension is of type .htaccess.
  7. Connect to ONID (shell.onid.oregonstate.edu) via SSH. Basic directions can be found by following the previous link. You will have to use the SSH Secure Shell client to connect and get a shell prompt.
  8. At the shell:~> prompt type htpasswd -c .htpasswd {username} and press enter to create the .htpasswd file in your home directory.
  9. Replace {username} with the username you would like to user for web authentication. Note: If you wish to password protect another directory, type cd {directory path} before you create the .htpasswd file. Replace {directory path} with the directory path e.g. public_html/spring2010/assignments
  10. Type the password you would like to use.
  11. Retype the password you would like to use.
  12. Move the .htaccess file from your computer to the directory you wish to password protect.

For assistance, contact the IS Service Desk.


Article ID: 45722
Wed 1/3/18 2:30 PM
Tue 11/10/20 5:04 PM