Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpMyAdmin allow remote users

I need to modify the file /etc/httpd/conf.d/phpMyAdmin.conf in order to allow remote users (not only localhost) to login

# phpMyAdmin - Web based MySQL browser written in php #  # Allows only localhost by default # # But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL  Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin  <Directory /usr/share/phpMyAdmin/>    <IfModule mod_authz_core.c>      # Apache 2.4      <RequireAny>        Require ip 127.0.0.1        Require ip ::1      </RequireAny>    </IfModule>    <IfModule !mod_authz_core.c>      # Apache 2.2      Order Deny,Allow      Deny from All      Allow from 127.0.0.1      Allow from ::1    </IfModule> </Directory>  <Directory /usr/share/phpMyAdmin/setup/>    <IfModule mod_authz_core.c>      # Apache 2.4      <RequireAny>        Require ip 127.0.0.1        Require ip ::1      </RequireAny>    </IfModule>    <IfModule !mod_authz_core.c>      # Apache 2.2      Order Deny,Allow      Deny from All      Allow from 127.0.0.1      Allow from ::1    </IfModule> </Directory>  # These directories do not require access over HTTP - taken from the original # phpMyAdmin upstream tarball # <Directory /usr/share/phpMyAdmin/libraries/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  <Directory /usr/share/phpMyAdmin/setup/lib/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  <Directory /usr/share/phpMyAdmin/setup/frames/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  # This configuration prevents mod_security at phpMyAdmin directories from # filtering SQL etc.  This may break your mod_security implementation. # #<IfModule mod_security.c> #    <Directory /usr/share/phpMyAdmin/> #        SecRuleInheritance Off #    </Directory> #</IfModule> 
like image 241
Germano Massullo Avatar asked May 16 '14 21:05

Germano Massullo


People also ask

How do you allow IP address in phpMyAdmin?

Connect to the server with ISPmanager via SSH. Open the phpMyAdmin configuration file /etc/nginx/vhosts-includes/phpmyadmin. conf. For the authentication settings to work correctly, add the IP address of the control panel to the list of permitted IP addresses.


1 Answers

The other answers so far seem to advocate the complete replacement of the <Directory/> block, this is not needed and may remove extra settings like the 'AddDefaultCharset UTF-8' now included.

Update 2021

The config file is now simplified so just needs a single line adding:

<Directory /usr/share/phpMyAdmin/>    AddDefaultCharset UTF-8     Require local    # ADD following line:    Require all granted </Directory> 

Original Answer

To allow remote access you need to add 1 line to the 2.4 config block or change 2 lines in the 2.2 (depending on your apache version):

<Directory /usr/share/phpMyAdmin/>    AddDefaultCharset UTF-8     <IfModule mod_authz_core.c>      # Apache 2.4      <RequireAny>        # ADD following line:        Require all granted        Require ip 127.0.0.1        Require ip ::1      </RequireAny>    </IfModule>    <IfModule !mod_authz_core.c>      # Apache 2.2      # CHANGE following 2 lines:      Order Allow,Deny      Allow from All      Allow from 127.0.0.1      Allow from ::1    </IfModule> </Directory> 
like image 198
chris Avatar answered Sep 19 '22 20:09

chris