How to enter adminer without password?

旧街凉风 提交于 2020-08-25 08:02:06

问题


Using adminer-4.7.2-mysql.php on my home laptop with Kubuntu 18 is there is a way to login to it without password entering? Or session time as long as possible ?

Thanks!


回答1:


Adminer doesn't allow connection without password for security reasons.

If you want to login without password because you're working in local environment you must use the login-password-less plugin.

1. Install adminer default core file

Download the adminer core file PHP:

wget https://github.com/vrana/adminer/releases/download/v4.7.5/adminer-4.7.5.php

Then rename it to adminer_core.php:

mv adminer-4.7.5.php adminer_core.php

Access to this adminer file from web browser and test login without password.
You can see the error message from Adminer by default:

2. Install plugins

To use plugins with Adminer you need to install the plugin autoloader file:

mkdir plugins
cd plugins
wget https://raw.githubusercontent.com/vrana/adminer/master/plugins/plugin.php

Then install the login password less plugin into plugins directory:

wget https://raw.githubusercontent.com/vrana/adminer/master/plugins/login-password-less.php

3 Configure your Adminer password

Last step is to define a password that will not be use for MySQL connection but only for Adminer authentification:

nano adminer.php

In this file copy/paste the following code and replace YOUR_PASSWORD_HERE by any password you want:

<?php
function adminer_object() {
    include_once "./plugins/plugin.php";
    include_once "./plugins/login-password-less.php";
    return new AdminerPlugin(array(
        // TODO: inline the result of password_hash() so that the password is not visible in source codes
        new AdminerLoginPasswordLess(password_hash("YOUR_PASSWORD_HERE", PASSWORD_DEFAULT)),
    ));
}
include "./adminer_core.php";

4. That's it!

Now you can access to http://localhost/adminer.php and authenticate yourself with the previous password you have set in adminer.php.

In resuming you have the following architecture:

└ localhost
  ├ adminer.php
  ├ adminer_core.php
  └ plugins
    ├ login-without-password.php
    ├ plugin.php

Enjoy! ☺☼♪♫



来源:https://stackoverflow.com/questions/58009920/how-to-enter-adminer-without-password

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!