Questions tagged [.htpasswd]

.htpasswd is a flat-file used to store usernames and password for basic authentication of Apache HTTP Server.

.htpasswd is a flat-file used to store usernames and passwords for basic authentication on Apache HTTP Servers. The name of the file is given in the .htaccess configuration, and can be anything, but ".htpasswd" is the canonical name. The file name starts with a dot, because most Unix-like operating systems consider any file that begins with dot to be hidden.

This file is often maintained with the shell command htpasswd which can add, delete, and update users, and will properly encode the passwords for use (so they are easily checked, but cannot be reversed back to the original password).

The file consists of rows. Each row corresponds to a username and hashed password pair, separated with the colon. For example:

user:password

The hashed password is typically "UNIX crypt" style, encrypted in either MD5 or SHA1 as common alternatives.

Additional users can be added by using the htpasswd shell command or by appending new lines to the file. For example:

user1:password1
user2:password2

Resources available on the Apache HTTP server can be restricted to users listed in the files created by htpasswd.

See also

526 questions
12
votes
7 answers

403 forbidden - Nginx - using correct credentials

I am trying to password protect a directory on my Nginx powered site that contains things like phpMyAdmin, MemcacheMyAdmin, and more admin utilities. This directory is placed in the root of my site at: domain.com/control/ The absolute path on my…
Playforward
  • 560
  • 2
  • 6
  • 21
11
votes
3 answers

.htaccess basic auth by virtual host?

I was wondering if it was possible to setup a conditional http basic auth requirement based on the virtual host URL in an .htaccess file. For example what I want to do is have mysite.com and test.mysite.com run off the same code base in the same…
user410925
  • 189
  • 1
  • 2
  • 8
11
votes
4 answers

Apache 2.4 "..authentication failure..:Password Mismatch"

I am running Apache 2.4 in Windows Server 2008 R2. I am attempting to password protect a subdirectory and successfully did so in Apache 2.0. After upgrading I took Apache's advice and am attempting to put the authentication config in httpd.config. I…
user1991179
  • 573
  • 3
  • 8
  • 25
10
votes
2 answers

.htpasswd on specific subdomain

I have a language specific subdomain that points to the same dir as the root as my site. I use PHP to detect it and show the language. I wish to set an htpasswd on this subdomain only. Keep in mind that there is no physical directory specific to…
Sebastien
  • 2,607
  • 9
  • 30
  • 40
10
votes
4 answers

Can I copy/paste htpasswd files to my new server?

I'm documenting the procedure for a full redeploy on my development server. Small staff, using Basic authentication (over SSL, of course) with an htpasswd file backend. Is it safe to transfer the .htpasswd file as-is? The Operating Systems will…
jds
  • 861
  • 6
  • 14
10
votes
2 answers

password protect a single file using .htaccess

I have tried to password protect a single file using .htaccess. But when accessing the file the browser just redirects to the home page of the website. I have my .htpasswd on my webroot. My .htaccess file is given below
Shanker Krishnan
  • 111
  • 1
  • 1
  • 3
9
votes
1 answer

Apache htpasswd secure password change

My question is simple. How to allow users to change their passwords stored in some htpasswd file in linux without revealing the files content or allow users to modify other passwords? I tried to write a script to do that job using ssh and…
Rusty Horse
  • 2,388
  • 7
  • 26
  • 38
9
votes
2 answers

How to access htpasswd-protected page automatically

I have a passwordprotected directory with htaccess and htpasswd. The htaccess looks like this AuthUserFile /usr/local/you/safedir/.htpasswd AuthGroupFile /dev/null AuthName EnterPassword AuthType Basic require user myusername The htpasswd looks…
Demilio
  • 673
  • 1
  • 10
  • 20
8
votes
2 answers

Edge chromium won't show basic authentication popup?

I have an Apache server v2.4.43 that serves my website, and I use a simple .htpasswd that I call in .htaccess using the instruction "AuthUserFile " for my authentication. Now the solution works with all browsers (a popup…
Abderrahmane
  • 385
  • 2
  • 3
  • 14
8
votes
2 answers

Login page vs. htpasswd - Which is more secure?

Given a simple login system (register and login), which of the two choices is more secure: Using htaccess and htpasswd files to store and authenticate users Using php to CRUD and MySQL (or any other database really) to store the info User info…
Zirak
  • 38,920
  • 13
  • 81
  • 92
8
votes
1 answer

How can I make sure AuthName works in all browsers?

The code below appears to show the text "HELLO WORLD" just fine in Firefox, IE, Safari, but not in Chrome. AuthType basic AuthName "HELLO WORLD" AuthBasicProvider file AuthUserFile /home/.htpasswd Require…
IMB
  • 15,163
  • 19
  • 82
  • 140
8
votes
5 answers

how to generate a hash like apache's htpasswd using java

i use "Force MD5 encryption of the password" in htpasswd to generate a hash for instance '123' i get: use htpasswd: 123 => $apr1$kaTbKaLO$ewJXRZAKpjaxK4thy2jOp/ use MD5 digest: 123 => 202cb962ac59075b964b07152d234b70 please tell me how can i…
robinmag
  • 17,520
  • 19
  • 54
  • 55
8
votes
3 answers

.htaccess Password protection keeps asking for password over and over

I've placed this code in the .htaccess file of the folder I want to protect: AuthName "restricted area" AuthType Basic AuthUserFile /home/#/#/#/#/#/.htpasswd require valid-user In the same folder, I placed this .htpasswd: my:pass When I go to the…
rockyraw
  • 1,125
  • 2
  • 15
  • 36
8
votes
2 answers

Why .htaccess and .htpasswd does not accept my log-in info

My Question Why .htaccess and .htpasswd does not accept my log-in info? My sources to learn what should I…
Andre Chenier
  • 1,166
  • 2
  • 18
  • 37
7
votes
2 answers

Cakephp Password Protection with htaccess and htpasswd - howto?

How can I password protect my website during development with htaccess in Cakephp? which htaccess file do I have to change? what do I have to write in the htaccess where do I put the .htpasswd? I searched google for that but couldn't find anything…
1
2
3
35 36