Locked Out from Magento admin?

Here’s the situation, you, client, webmaster, pet or whoever was playing with users and roles in your favorite store and deleted only main admin account or broke admin account privileges. If it happened to you and you’re locked out from your Magento store, read on.
This script creates new admin user associated to new Inchoo role with all privileges set. Of course, you have to have FTP access for this to work.
Download newadmin script, unpack it, open newadmin.php file (notepad will do) and define username, email and password of the new user. Username and email must be UNIQUE in Magento, so use some new ones and not the old ones that are already in the system, you’ll change it later after you login.
Connect with FTP and copy newadmin.php file to root of your store and run it through web browser like
http://www.yourstore.com/newadmin.php
The script will try to delete itself after user is created, but please make sure it’s removed from the server. Code is tested on 1.3.x versions of Magento and I don’t believe it will work on older versions, so please write some feedback.
Regards 😉
75 comments
Hello,
Does it work for Magento M2 CE ?
Below is the error that I am getting
app/Mage.php was not found <———————————–
Thank you so much! Worked on 1.7!
I am so grateful!!! You saved us, thank you very much!!!
Life saver! Thank you so much sir! 🙂
Hello,
It worked for me on 1.8 . Thanks a lot for this.
Any idea how can I get the old admin back?
Thanks again!
It works on 1.8.1.0. Thank you!
I have tried this script but doesnt work for me , I am using magento ver 1.7
I will appreciate if you put more information. Thank you
User creation is working Good.
Please put code for Reset Admin Password.
Thank you so much for this! I’ve installed a Fooman Surcharge plugin and was unable to login to admin (with Username / Password not valid error message). After running the script was able to go back into the system.
To restore the admin one has to edit the Administrators role and save it. Then change the password for the existing original admin user and change the role to Inchoo and than back to Administrators
Once again this was a life saver. Thank you!
Werkt prima met 1.8.1.0
Dear Sir,
I followed your solution with my installed magento 1.9 . it will be logged, but after that 127.0.0.1/magento in localhost, it shows “The requested URL “http://127.0.0.1/magento/errors/report.php?hsimp=yhse-001″ cannot be found or is not available. Please check the spelling or try again later.”.
Parse error: syntax error, unexpected ‘@’, expecting ‘)’ in D:\EasyPHP-5.3.6.0\www\fresh\newadmin.php on line 34
@ is not supported how could i type email address
hello I am trying this but when i type email address in file i get red highlighted php error in coding.
Any help will be appreciated.
Thanks,
hi Ivan,
i have done all the things u suggested but still i m not able to login. after creating a new user , at the login page i m getting an error username and password is not correct .
i have a support username and passwordits working but its rights had been lost. i wanna get back the all rights. please help me to fix the issue.
Thank you very much… it works like wonder on Magento ver. 1.8.1.0
Thanks, this was a lifesaver!!
Thanks for feedback, it’s good to hear it still works 🙂
Thank You Very Much. Works in 1.8.0.0
Still works in 1.7 – Thank you for this great timesaver! 🙂
Thank you very much for this.
OMG this just saved me, THANK YOU!
Ivan, you Sir are a scholar and a gentlemen 🙂
(for putting together this script AND providing it).
I used it to gain access to the Magento backend again, after the server crashed during a system restore – which had apparently deleted all Magento admins and so we were getting the “Invalid username or password”, although the original login and password were correct.
NOTE: Because the maintenance flag was set during the system restore, we had to manually remove the ‘maintenance.flag’ file to be able to even get to the login page again.
Thank you so much! I still do not know how to get back to my old admin with all my info but at least I got the new one so I can use it.
thanks buddy. time saved!!!
Excellent Job my Friend…. greetings from Mexico…!!!!!