强制远程loginphpMyAdmin

我希望用户能够从任何计算机访问phpMyAdmin。 有多个用户,我想要求login。 只有远程访问肯定是可以的。 (我所需要做的就是使用远程地址。)远程访问是必需的。

我已经build立了PHP 7.0.13和4.6.5.2 phpMyAdmin(XAMPP)的Apache 2.4.23服务器。 我已经build立了多个账户访问MySQL,并testing每个人可以login和注销本地主机(也是在不使用的时间限制后自动注销)。 当我转移到远程访问phpMyAdmin,phpMyAdmin自动login到root帐户,无法注销。 注销button在那里,但描述是“清除会话数据”,这就是它所做的一切。

我一直在寻找几天的答案,并可以保证更改auth_typeconfiguration或http不能解决它。 我发现的其他解决scheme都没有任何效果。

更新:我设置root和pma的密码,它在本地主机上正常工作。 远程访问引发访问被拒绝的错误。

这是我的config.inc为phpMyAdmin(我已经testing了许多变化上部.. auth_type等):

<?php /* * This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = false; $cfg['Lang'] = ''; /* Bind to the localhost ipv4 address and tcp */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; /* User for advanced features */ $cfg['Servers'][$i]['controluser'] = 'pma'; $cfg['Servers'][$i]['controlpass'] = ''; /* Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; $cfg['Servers'][$i]['relation'] = 'pma__relation'; $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; $cfg['Servers'][$i]['history'] = 'pma__history'; $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords'; $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; $cfg['Servers'][$i]['recent'] = 'pma__recent'; $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; $cfg['Servers'][$i]['users'] = 'pma__users'; $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; /* * End of servers configuration */ ?> 

auth_type config表明configuration文件将使用用户名和密码configuration,在你的情况下

 $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; 

要改变这种行为,你应该设置auth_type来清除cookie,然后重试。

如果你想从本地访问phpMyAdmin,使用“root”而不input凭据,如你的configurationbuild议,但你想远程强制用户login,你可以做一个简单的黑客攻击,

 $ip = $_SERVER['REMOTE_ADDR']; if ( ! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) ) { $cfg['Servers'][$i]['auth_type'] = 'config'; } else { $cfg['Servers'][$i]['auth_type'] = 'cookie'; }