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
0
votes
0 answers

DocumentRoot is password protected but no htaccess file?

At some point I pw protected /var/www/ for security purposes (my actual hosted websites are located in a different path), now I would like to host something publicly in /var/www/ but do not know how to remove the pw protection. There is no .htaccess…
user1765369
  • 1,333
  • 3
  • 11
  • 19
0
votes
1 answer

.htaces and .htpasswd give error?

Well, I'm trying to secure my xampp with .htaccess and .htpasswd and I don't see a mistake, so do many other developers that I know... My .htaccess: AuthName "Protected Area" AuthType Basic AuthUserFile C:/xampp/secret/hidden/place/.htpasswd require…
LisaW
  • 171
  • 2
  • 3
  • 11
0
votes
0 answers

htaccess / htpasswd in subdir

im using a gallery script in root directory that reads a subdirectory and lists images inside. /gallery/index.php?gallery=aaa --> lists thumbs in folder /gallery/aaa/thumbs/ /gallery/index.php?gallery=bbb --> lists thumbs in folder …
peter rea
  • 45
  • 7
0
votes
1 answer

htpasswd / htaccess reoccurs asking for login

I have a htaccess setup like so. AuthType Basic AuthName "Authentication Required" AuthGroupFile /dev/null AuthUserFile "/home/alltest/public_html/.htpasswd" require valid-user for some reason for every file linked to the…
Barkermn01
  • 6,781
  • 33
  • 83
0
votes
1 answer

How to ignore some directory in htpasswd?

I set some htaccess with htpasswd on my server. Here is it's content: Order Allow,Deny AuthType Basic AuthName "Password" AuthUserFile /var/www/.htpasswd Require valid-user Satisfy Any It works for all /var/www/* directories. Is it possible to…
hsz
  • 148,279
  • 62
  • 259
  • 315
0
votes
1 answer

Apache - match file in all directories

Looking for some guidance on how I can match a specific file in a wildcard of directories. Example - the rule needs to apply to: /path/to/folder1/directory/index.php /path/to/folder2/directory/index.php /path/to/folder3/directory/index.php Here is…
Brian Spraker
  • 55
  • 1
  • 8
0
votes
1 answer

htpasswd security - sent in non-protected requests?

I understand htpasswd is pretty secure if done through SSL. Question: I visit directory "mysite.com/protected/" (https) and log in via htaccess/htpasswd. In the same browser I open up a new tab to "mysite.com/unprotected/" (http). Is the user/pass…
0
votes
2 answers

Protect folder with password fails on localhost (under Apache and Windows)

I am trying to protect a folder from direct access with username and password on localhost under Apache webserver on Windows machine. According to this article, I've looked for DOCUMENT_ROOT value in phpinfo results and found the following:…
Giorgio
  • 1,940
  • 5
  • 39
  • 64
0
votes
3 answers

Get username of login

Is it possible to get the username of someone who has succesfully authenticated through the htpasswd process and put that in a session variable? User: mave Pass: mave123 Successful login: write 'mave' to session?
Mave
  • 2,413
  • 3
  • 28
  • 54
0
votes
1 answer

Apache2 password protected Vhost configuration

I have a problem with a password protected vhost on apache2 and debian (7). It's a server which hosts several vhost. They are all online for now. I need to restrict access only for one of them. (www.acticia.net) I do not want to use .htaccess while…
mat.viguier
  • 127
  • 1
  • 1
  • 11
0
votes
1 answer

Apache custom error page

I'm trying to use htpassd for my sites, and whitelist a couple of ips. This works perfectly, but if the user presses the cancel button, it shows the standard apache 401 error page. With ErrorDocument I am supposed to cusomize it, so I placed a html…
Richard Deurwaarder
  • 2,023
  • 1
  • 26
  • 40
0
votes
1 answer

File Authentication: Need to prompt authentication when opening a file on every time

I have to prompt an authentication for a file while opening on every time. I have tried it with PHP Authentication. if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { } But, It is not asking for every time. Can we do it…
user2987836
  • 1,543
  • 2
  • 10
  • 8
0
votes
1 answer

htaccess to index.php only (no subfolders, files etc)

Im trying to password protect index.php (or html) file only but can't manage. Subfolders need to be accessed without password... Something like... AuthUserFile /var/www/clientarea/.htpasswd AuthName…
niksos
  • 309
  • 1
  • 4
  • 7
0
votes
1 answer

htaccess a wordpress site

Im trying to secure my wordpress site behind htaccess but seem to be getting a fail. HTML AuthType Basic AuthName "Password Protected Area" AuthUserFile www.sample.com/.htpasswd Require valid-user Any ideas?
Rob
  • 1,493
  • 5
  • 30
  • 58
0
votes
1 answer

Password protection for a single .htaccess rewrite

I need a password protection for a single site. This is a seo friendly url: The default path is: http://www.website-url.com/index.php?id_cms=xx&controller=cms and here is the seo url: http://www.website-url.com/content/xx-login I have already the…