Campuses:
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:accounts:web_publishing:acl [2007/06/11 12:17] – rubin | computing:accounts:web_publishing:acl [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | <box 30% right right-clear red|Web Publishing Information> | ||
| - | {{indexmenu>: | ||
| - | </ | ||
| - | ====== Controlling Access to Web Pages ====== | ||
| - | ===== By username and password ===== | ||
| - | These steps really have to be performed from the Unix command line. Please also note that preparing files in a non-unix text editor (Windows or particularly Mac) may not work as expected due to the different line break characters used. | ||
| - | |||
| - | 1. Create a file named .htaccess in the directory you wish to protect, that looks similar to the following. | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | < | ||
| - | | ||
| - | order allow,deny | ||
| - | allow from all | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | NOTE: Make sure your htpasswd and htgroup files are outside of the public-html directory, so they can't be downloaded using the web server. In this example, the home directory is / | ||
| - | </ | ||
| - | |||
| - | 2. Create your htpasswd file using the htpasswd command, in the directory you specified above in .htaccess. Note, the htpasswd command is only available on our main servers (physics.umn.edu), | ||
| - | |||
| - | htpasswd -c passwd_file user_name | ||
| - | |||
| - | eg, | ||
| - | |||
| - | htpasswd -c / | ||
| - | |||
| - | The above command both creates the password file and adds the first user name to it. You should be prompted for a password for the user. You can add further users to the password file using the same command but without the -c switch. | ||
| - | |||
| - | 3. Create your htgroup file (using a text editor). It should look something like: | ||
| - | |||
| - | | ||
| - | |||
| - | |||
| - | < | ||
| - | NOTE: The group name " | ||
| - | </ | ||
| - | |||
| - | ===== By domain name ===== | ||
| - | |||
| - | It's also possible to restrict access according to the clients location. For example, you could restrict a directory to be accessed only from within .umn.edu using a .htaccess file like this: | ||
| - | |||
| - | < | ||
| - | order deny,allow | ||
| - | deny from all | ||
| - | allow from .umn.edu | ||
| - | </ | ||
| - | |||
| - | |||
| - | You can also restrict access to our department only, but you have to list all the domain names in use here (e.g., hep.umn.edu, | ||
| - | |||
| - | If you're working on your pages locally, it may be difficult to test your access rules, to make sure they are working! One way you can do a partial test is to give your protected URL to a web validation service (for example, the [[http:// | ||