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

How to set up authentication for docker registry?

I have successfully set up a docker registry mirror with TLS, but without authentication, following these instructions: https://docs.docker.com/registry/recipes/mirror/. That works fine. I then tried to set up another registry that includes…
naraghi
  • 430
  • 1
  • 6
  • 18
0
votes
1 answer

Apache BasicAuth .htpasswd

Issue: My requirement is to implement BasicAuth to my website when I login. Now when load my website it is asking me the credentials and after successful login I can see the landing page of my website. When I do some operation on this landing page…
0
votes
2 answers

Protect single WordPress posts with .htacces and .htpasswd

I'm lost and might need some guidance. Spent the last two days searching for a working solution, found plenty of posts, many of them pretty old, but nothing that would help. For a client I'm running a WordPress site that has two functions: be an…
FollaKY
  • 11
  • 1
0
votes
1 answer

How to Setup multiple user with htpasswd for docker registry that each of the has only access to their personal path?

I have a docker registry that uses htpasswd for authentication. I want to have multiple users each can only pull images from a certain path. For example: user1 can pull images only from the below path mydomain.com/v2/user1/ user2 can pull images…
0
votes
2 answers

How to get htpasswd in Docker Registry to work?

I have been over numerous tutorials and I cannot get htpasswd to work in my private Docker Registry. Here is my folder structure: ├── auth │   └── htpasswd ├── certs │   ├── registry.my.domain.crt │   ├── registry.my.domain.csr │   └──…
Lord M
  • 67
  • 1
  • 10
0
votes
1 answer

htpasswd coflicting with htaccess

When I try to add AuthType my site does not work when I enter my password. Do you know what is wrong? I am getting error 500. But without AuthType it works AuthType Basic AuthName "restricted area" AuthUserFile .htpasswd require…
debek
  • 331
  • 7
  • 15
0
votes
2 answers

PHP and htpasswd

I have a structure like this: /home /home/dir1 /home/dir2 Now when someone goes to /home, he is asked for username and password (in a form) and I set session information in PHP for the remaining files of /home. Now /home/dir1 and /home/dir2 are…
Alec Smart
  • 94,115
  • 39
  • 120
  • 184
0
votes
1 answer

why is the .htaccess auth command not working in a directory in Drupal 9

i have a mini website below my sites default files directory and i am trying to make it be password protected with the following .htaccess file which i put in that same directory: #Protect Directory AuthName "Dialog prompt" AuthType…
Diana
  • 234
  • 1
  • 4
  • 15
0
votes
1 answer

htaccess for admin panel

How can I add .htaccess? I have two files it is .htaccess and .htpasswd. But this files work only when they are in folder admin. How can I add it only for admin. admin.php is in main directory. I mean that admin.php is not in folder…
0
votes
1 answer

Apache2 .htpasswd AuthName

Have a small site running on my RaspPI at home - apache2/php. Have created .htpasswd file in /etc/apache2/ and set it to be used in my main ssl config in apache2/sites-available/ Looks a bit like this:
chatlow
  • 91
  • 1
  • 2
  • 5
0
votes
1 answer

.htaccess only protecting folder sometimes

Website https://ochab.us Desired behaviour When you click on any of the projects on the homepage, for it to require a password before taking you to that page. Actual behaviour If you go directly to the project page…
Hood
  • 31
  • 4
0
votes
1 answer

Python htpasswd set zipfiles and delete

I have a flask web app and after a long time run, I want to send an email with a download link to the zip file created and stored after the long time run. The zip file should be htpasswd protected. My ideas up to now: Create a zip file with the…
honeymoon
  • 2,400
  • 5
  • 34
  • 43
0
votes
1 answer

Redirect when htaccess login fails

i wonder how to set a redirect rule when user is typing wrong username or password. currently the .htaccess is placed in /path/to/my/dir/website/dlfiles The user is on the website on path /path/to/my/dir/website/ with url…
0
votes
0 answers

Password Protected Files in Directory using .htaccess and .htpasswd, but files do not display

I created a password protected files using .htaccess and .htpasswd, but it doesnt show up when I goto the URL. I have this in my htaccess: #Protect multiple files AuthName "Dialog prompt" …
Patoshi パトシ
  • 21,707
  • 5
  • 29
  • 47
0
votes
1 answer

.htpasswd doesnt protect .txt files

i have a basic auth protected directory with : AuthType Basic AuthName "restricted area" AuthUserFile /path/to/.htpasswd require valid-user every thing is ok and directories are not visible , and force to login , but .txt files are visible…
Ali
  • 118
  • 6