HTTP Security or Authentication with .htpasswd On Mac OS X

I think most of you are aware of http security using .htpasswd. It is the way to secure any directory or domain. I was using it in windows with some htpasswd generator. On unix based system it’s more easier for anyone to secure any directory or webpage.

All you need to do the following:

  1. Open terminal , you’ll find it under /Application/Utilities  (I know you’re aware 🙂 )
  2. Type a command
    • $ htpasswd -c /../web/.htpasswd username
    • After running the command it’ll ask for your password. The htpasswd for username/password is set for you.
  3. Now you need to create a .htaccess file at the directory you want to protect , suppose /…/web/.htaccess. Now your .htaccess should have the following lines.

    AuthName "Login"
    AuthUserFile /.../web/.htpasswd
    AuthGroupFile /dev/null
    AuthType Basic
    require valid-user

Now save .htaccess and try running the page, You need to provide the username/password you set.

On windows the same process you need to do but need to generate the .htpasswd from any source and create .htpasswd manually then the rest are same.

It’s really easy for Mac Os X.

Good night!


, , , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: