4

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!

mstdmstd
  • 2,195
  • 17
  • 63
  • 140

5 Answers5

11

If anyone is still looking for a quick workaround for this please follow the below instructions.

  1. Open the downloaded adminer.php file in any text editor.
  2. Use the find command to find the login method it will kinda look like this one.Login($ye,$F){if($F =="") return
  3. Type anything between "" double quotes like "abc" and save the file.

That's it problem Solved. You can now login to adminer without a password.

sohail amar
  • 381
  • 2
  • 14
  • I uploaded adminer-4.7.7-en.php , that is some encoded file, like : https://prnt.sc/uryvm4 and I did not find substring you mentioned Please clarify, which file do you edit and which version you uploaded? I need english only for all databases. – mstdmstd Oct 02 '20 at 14:57
  • @mstdmstd I think you just skipped this line, I have checked on your mentioned version in English version only, and found it on line# 1564. https://www.screencast.com/t/Qp4irCaW1 – sohail amar Oct 12 '20 at 17:44
  • 1
    if($E=="" && false) – HoseinGhanbari Oct 23 '20 at 21:47
  • 1
    Since it's obfuscated in some way, i suppose it looks different depending on the flavor and release. I my case; https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1-mysql-en.php It's at line 249, and has the content `login($Cd,$G){if($G=="")return` so i suggest you just search for "login" and you'll find it quickly enough. Many thanks Sohail. What an infuriating "feature" of an otherwise excellent tool. – PKSWE Jun 26 '22 at 20:14
  • VS code ruined the file with unknown characters after save, Made me download a fresh file and update it via Notepad++ – Mohammad Salehi Jul 29 '23 at 12:33
  • best answer this question. Great. – Sujeet malvi Aug 23 '23 at 05:05
10

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: Adminer error message login without password not allowed

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! ☺☼♪♫

Antoine Subit
  • 9,803
  • 4
  • 36
  • 52
  • I returned to this question and trying to complete it I found that in the last listing of the project files there is login-without-password.php mentioned, but there is no code for this file. 1) I tried to login as it is and failed. 2) Could you please provide code of login-without-password.php ? 3) I do not use root user for login. If you way works in this case? – mstdmstd Aug 11 '20 at 15:12
2

If you want to login without a password because you're working in the local environment

  1. Install the latest admirer https://github.com/vrana/adminer

  2. Open file adminer.php

  3. Search and change from login($ze,$F){if($F=="")return to login($ze,$F){if(1==1)

  4. type root in field username and click login

  5. Now you can access adminer without a password

ega rifs
  • 29
  • 5
0

I tried above methods but did not work for me so I did the following which works in 2021 for Adminer 4.7.9.
WARNING: Please note that its only for your local machine & not advised for online databases.:
Step-1: Download Adminer source from Github, this link.
Step-2: Open adminer-master\adminer\include\auth.inc.php
Step-3: Edit the following at lines 55 to 57 & replace my_username & my_password with your MySQL credentials:

$server = "localhost";  //$auth["server"];
$username = "my_username";    //$auth["username"];
$password = "my_password"; //(string) $auth["password"];

Step-4: Save & now open Adminer by pointing your browser to "adminer-master\adminer"
Step-5: Just click Login button & you will login without entering anything.

MyO
  • 413
  • 1
  • 8
  • 19
-1
/*******************************************************
** Adminer, since version 4.7.0 does not accept        *
** connections without a password.                     *
** For version 4.7.x to accept an empty password,      *
** in the adminer-4.7.x.php file, replace :            *
** login($Ae,$F){if($F=="") by login($Ae,$F){if(1===2) *
** This can be done automatically by replacing false   *
** with true in the line below.                        *
*******************************************************/
$AcceptEmptyPassword = true;
Adriaan
  • 17,741
  • 7
  • 42
  • 75
newbie
  • 1