OS X Server

From ITS Wiki - Information Technology Services - University of Rhode Island

Jump to: navigation, search
Desktop Black.png Macintosh

This page is part of a category. To see more pages like this, go to the Macintosh index.
Important.png ATTENTION
This article is for experienced users ONLY. Do not attempt the following if you are unfamiliar with the material. If in doubt, please contact the Help Desk at 874-HELP.


This document explains how to password-protect a folder on an OS X server such that web users are prompted to enter a username and password before accessing the folder.

Password Protecting Files

1. Launch a terminal window.
2. Type: cd /private/etc/httpd
3. Type: sudo pico httpd.conf

Look for the following line,

 AllowOverride None

Edit this line to be,

 AllowOverride All

4. Save the httpd.conf file (ctrl+x).
5. Type: sudo htpassword -c .htpasswd username
6. You will be prompted to enter a username and a password. These are what web users will need to access the folder.
7. Type: cd /Library/WebServer/Document/AreaYouWishToSecure
8. Type: sudo pico .htaccess

Paste the following into the file,

 AuthUserFile /private/etc/httpd/.htpasswd
 AuthGroupFile /dev/null
 AuthName "Members Only"
 AuthType Basic
 <Limit GET POST>
 require valid-user
 </Limit>

Save this file (ctrl+x). Now restart Apache (or restart the server).