Views: 762 (Data available since 06.02.2017)

How to restore pasword for administrator

It is no doubt that a site administrator must have a good memory. Especially when there are a lot of sites with a lot of unique passwords that must be managed. So its no surprise that at some point one of such passwords can be forgotten.

In this situation, one of the methods listed below can be used to restore the administrator password.

Method No.1

  1. Password is restored for the user with ID=1 (due to the fact that it is the first user, registered in the system, this user has the administrator access permission rights). That is why, first try to remember the login information for this user (admin is set by default). The very first user can be clarified via the following script:
    $rsUser = CUser::GetByID(1);
    $arUser = $rsUser->Fetch();
    echo "<pre>"; print_r($arUser); echo "</pre>";
    
  2. Then, save the next sript 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. Upload the created script via FTP into the site root catalog at www/site name/... and open it in the browser. After that, this user with ID=1 (by default - administrator) will have the password: Bitrix*123456
  4. Now get authorized at the site under the former login (see item 1) and standard password (see item 3). Set your own password in the Control panel.

If the access for unauthorized users is closed, then prior to password restoring procedure, edit the .access.php file in the site root folder, by replacing:

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

Attention! Delete the uploaded file with the script after the password is restored, as well as roll back all implemented changes!


Method No.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 the site root catalog at www/site name/... and open it in the browser.
  3. Get authorized at the site (the login and password will not be requested), and set your own password in the Control panel.

Attention! Delete the uploaded file with the script after the password is restored!





Courses developed by «Bitrix», Inc.