Views: 6647
Last Modified: 26.10.2021

How to restore administrator password

Administrator user role requires a good memory. Especially, when there are a lot of sites and each site has its own password. However, at some point, a password may be forgotten. In such cases admin passwords can be restored using one of methods below.

Method #1

  1. Password is restored for user with ID=1 (due to this user being first user, registered in the system and having admin access permissions). That's why, first you need to remember login for this user (admin is set by default).
  2. Next, save the following script into PHP file with any name:
    <?
    require($_SERVER['DOCUMENT_ROOT']."/bitrix/header.php");
    echo $USER->Update(1,array("PASSWORD"=>'Bitrix*123456'));
    echo $USER->LAST_ERROR;
    require($_SERVER['DOCUMENT_ROOT']."/bitrix/footer.php");
    ?>
  3. Download the created script via FTP into the site root directory www/site_name/... and open it in browser "Open" means typing site URL in the top address bar with filename and path.
    For example: http://your_site/folder with script/script_name.php
    . After that, user with ID=1 (administrator by default) has the password: Bitrix*123456
  4. Now get authenticated at the website under the previous login (see item. 1) and standard password (see item. 3). Set your new password in the control panel.

When access for unauthorized users is closed, modify the .access.php file in the site root before restoring the password:

$PERM["/"]["*"]="D";
to:
$PERM["/"]["*"]="R";

Attention! You must delete the uploaded file with script after restoring the password, and rollback all changes!

Method #2

  1. Save the next script into PHP file with any name:
    <? 
    require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
    
    global $USER;
    $USER->Authorize(1);
    
    require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");  
    ?>
  2. Upload the created script via FTP into root directory of site www/site_root/... and open it inside browser.
  3. Enter the site (both login and password won't be requested) and set password for your profile in inside the admin section.

Attention! You must delete the uploaded file with script after restoring the password!



0


Courses developed by Bitrix24