How can I control who accesses a particular directory?
You will need to create and use a .htaccess/.htpasswd combination. Note that [ ] marks indicate data you must supply. Leave the [ ] marks off when actually using commands.
Login to your shell and go to the directory you wish to protect. To create a new directory type mkdir [dir name] at the prompt. From within this directory type the following command:
prompt:> htpasswd -c .htpasswd [username]
This will create a file called .htpasswd with a user username (ex: members) You will be prompted for a password for this directory.
Next from within the protected directory create a file called .htaccess here. To do this type pico .htaccess In the .htaccess file place the following lines:
# Access file
Then you need to flag the .htpasswd and .htaccess files: chmod go+r
To do this simply type at the prompt: chmod go+r .ht*
Make sure the second line reflects the path of where you put the .htpasswd file. To find the path to the .htpasswd file, switch to that directory and type pwd