My Digital Story

What’s a small world…

Restrict phpMyAdmin access to only internal private IP address

I managed to configure my phpmyadmin to only allow access from within my network only (the private IP address range) e.g. 192.168.1.XXX.

This is important to ensure the security of your database, I just do not want people to guest all the password by entering into the phpmyadmin setting.

To do so, copy the following code to config.inc.php in the phpmyadmin folder:
//block root from logging in except from the private networks
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
'deny root from all',
'allow root from localhost',
'allow root from 192.168.1.0/24',
);

The “0/24″ denotes wildcat (equivalent to * in Windows)
After that chmod 705 the file
Then restart your lightpd server using the following command:
sh /ffp/start/lighttpd.sh restart

now your phpmyadmin can only be accessed from your LAN network only.

07/01/2009 - Posted by abuhawa | Networking, Uncategorized | | 6 Comments

6 Comments »

  1. Thank you for the script, was very helpful….:)

    Comment by sam | 28/05/2009

  2. Nice. It works, though it still allows people to try and log on. Would be better if PHPMyAdmin applied this to the logon page too.

    Comment by Tin | 18/06/2009

  3. Thanks for the tip. Very useful!!!

    Cheers

    Comment by Carlos Vendramini | 21/06/2009

  4. [...] fonte: Restrict phpMyAdmin access to only internal private IP address [...]

    Pingback by PHPMyAdmin somente para a rede interna « Linuxing | 21/06/2009

  5. FUCK ISLAM and eat HALAL ASS of your prophet

    Comment by FUCK ISLAM | 28/08/2009

  6. Thanks for the script. It did not work with my iMac, it still allow root access from other machines, although I commented the last line.

    I did not like the last comment. Even though I don’t agree with conservative Muslims, I don’t accept general blind blame

    Comment by Yahya | 18/10/2009


Leave a comment