# Protect phpmyadmin with http basic auth

**URL:** <https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588>\
**Category:** Community Support\
**Created:** [September 27, 2021, 2:51pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588 "2021-09-27T14:51:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trickster](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/trickster/32/2069_2.png) [@Trickster](https://forum.hestiacp.com/u/Trickster)\
**Post date:** [September 27, 2021, 2:51pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/1 "2021-09-27T14:51:36Z")

</div>

Hi,  
I’d like to protect phpmyadmin with http basic auth.  
So what was done:

1. I added to file /etc/phpmyadmin/apache.conf  
after line `<Directory /usr/share/phpmyadmin>`

```auto
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /usr/share/phpmyadmin/passwd
Require valid-user

```

1. After that new password was generated  
`htpasswd -c /usr/share/phpmyadmin/passwd user`

2. Configuration test  
`apachectl configtest`

3. Apache was restarted  
`systemctl restart apache2 && systemctl status apache2`

As a result I don’t see authorization window. Can anybody please help me, where is my error?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [September 27, 2021, 4:32pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/2 "2021-09-27T16:32:45Z")

</div>

/etc/phpmyadmin/apache.conf is not loaded

Use /etc/apache2/conf.d/conf.d/phpmyadmin.conf instead

---

<div class="post-metadata">

**Author:** ![Trickster](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/trickster/32/2069_2.png) [@Trickster](https://forum.hestiacp.com/u/Trickster)\
**Post date:** [September 27, 2021, 6:08pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/3 "2021-09-27T18:08:43Z")

</div>

Great! Thanks, now it works as it should!

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [September 27, 2021, 6:13pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/4 "2021-09-27T18:13:25Z")

</div>

Please be aware that we sometimes renew the config file

For example 1.4.15 release …

---

<div class="post-metadata">

**Author:** ![Trickster](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/trickster/32/2069_2.png) [@Trickster](https://forum.hestiacp.com/u/Trickster)\
**Post date:** [September 27, 2021, 6:47pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/5 "2021-09-27T18:47:28Z")

</div>

So update process will overwrite config. Right?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [September 27, 2021, 7:24pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/6 "2021-09-27T19:24:59Z")

</div>

Usually we don’t overwrite the phpmyadmin config how ever in this case due to some security “remarks” it makes for us easier to overwrite 1 config file then sed in all the changes.

---

<div class="post-metadata">

**Author:** ![system](https://forum.hestiacp.com/uploads/default/original/1X/d9a5b68bf50ced83e880b56452e592b204761b19.png) [@system](https://forum.hestiacp.com/u/system)\
**Post date:** [October 27, 2021, 7:25pm UTC](https://forum.hestiacp.com/t/protect-phpmyadmin-with-http-basic-auth/4588/7 "2021-10-27T19:25:10Z")

</div>

Closed on October 27, 2021, 7:25pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
