Password Protecting Ruby Web Directories

If you need to learn more about the Unix shell environment, try ITS's tutorial on basic Unix/Linux.

  1. Log on to your opal account (via SSH).

  2. Change to your public_html directory (cd public_html).

  3. Either create a new directory to password protect ( mkdir newdirectory) or change to the one you want to protect ( cd). Choose a subdirectory of public_html; otherwise, your entire public_html will become password-protected.

  4. At the prompt, type

  5. When prompted, enter the user name and password that you would like your users to use.

The program creates two files in the directory you are protecting: .htaccess and .htpasswd. You won't see these files on a regular ls command; you must type ls -a. Don't delete the files unless you want to remove the password protection.