拒绝特定用户的登录

Deny a particular user's login

我在 Ubuntu 上安装了 phpmyadmin 3.4。

现在我只想禁止用户(例如theuser)通过phpmyadmin 页面登录,同时允许用户在localhost 上登录。有办法吗?

phpmyadmin安装后,默认是允许其他用户访问的。为了安全起见,您需要设置一些访问限制,以控制外部用户的访问。

具体修改过程如下:

1) 打开xampp/apache/conf/extra/HTTPD-xampp。 conf文件,搜索<LocationMatch将require local修改为如下代码:

AllowOverride all
Order Deny,Allow
Deny from all
Allow from 192.168.9.25
Allow from 127.0.0.1

2) 打开\xampp\phpMyAdmin\config公司,PHP,搜索Authentication type and info,修改为以下值:

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '******';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Lang'] = '';

也可以修改用户以获得根用户的高级功能。

/ * the User for the advanced features * /
The $CFG [' the Servers'] [$I] [' controluser] = 'root';
The $CFG [' the Servers'] [$I] [' controlpass] = '* * * * * *';

3)重启Apache和MySQL服务,可以测试结果

如果您可以在您的安装中找到您的config.inc.php,请在您的特定服务器的配置下添加此

/* block SOME users */
$cfg['Servers'][$i]['AllowRoot'] = false;
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
    'deny theuser1 from all',
    'deny theuser2 from all'
);

这将禁止以 root、theuser1 或 theuser2 身份使用 phpmyadmin。其他没有变化。