24
Jan/09
0

Linux: .htaccess and .htpasswd files

You can use .htaccess to protect a directory on your Apache web server. Users trying to access a protected directory will be asked to enter a user and password. .htaccess defines the protected directory, and .htpassword stores your password hashes.

.htaccess normally looks like this:

AuthName "Title"
AuthUserFile /path-to-your-htpasswd-file/.htpasswd
AuthType Basic
require valid-user

To create a .htpasswd file:

htpasswd -c /path.to.the.folder.you.want.to.protect/.htpasswd <username>

or

htpasswd -c <username>

and you will be prompted to enter a password for <username>

Of course, you can use a .htpasswd generator. Remember, Google is your friend :)

Share this article
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter
  • LinkedIn

Related posts:

  1. Linux: htpasswd: command not found
  2. Linux: A simple and quick way of sharing a folder with Windows systems using Samba
  3. Linux: Download files using wget from protected url’s – resume broken downloads
  4. Linux: Mount remote Windows shares with smbfs
  5. Linux: vsftpd and symbolic links

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.