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



OK, theoretically, is that right that if someone has write access to one of magento’s directories on the server with the help of this script he can get an access to magento admin and all the confidential data?
WOW thanks dude fix it!
Yep, if you have read/write access to filesystem, you can do anything you want with the database.
That applies to any application.
Just to make a simple note…
if you guys just need to change the password, that for some reason you don’t remember and email system is not working properly in order to retrieve the new password, just point your browser into this nice article:
http://www.magentocommerce.com/wiki/general/resetting-admin-password
Amazing. Worked like a charm, thanks!
When I downloaded the ZIP file, WINZIP says it is not a valid zip file. Could it have gotten corrupted? Is it WINZIP compatible?
Hey David,
Go to celebrate new year. It is no time to write about Magento.
WOW thanks!!!!!!
Is there an extension that can check a magento install and make sure all the files and folder have proper read-write permissions? I had to play around with permissions a lot when installing extensions, I feel like I might have opened the pandora box.
Just wondering.
Root is the public_html/teejmart.com .. right?
Not sure which username, email and password to define though.
Help. .!
@Alvin: root folder is the one on your server where app, js, lib, media, skin, cron.php and other Magento folders and files are placed. It’s probably somewhere in public_html yes.
This script creates new admin user, so use any username, email and password you would like him to have.
Thanks Ivan. So the location is correct.
When I open the file, I see
//define USERNAME, EMAIL and PASSWORD and uncomment(#) this 3 lines ..etc..
what do i have to do ..? how do I “uncomment”? anyway, I changed all the username, email, and password to the ones I want.
When on the browser I got http://www.teejmart.com/newadmin.php – all i got is this
Edit this file and define USERNAME, EMAIL and PASSWORD.
I must have missed some details.
Alvin
@Alvin: Just remove # from beginning of those 3 lines and save the file.
Ivan … thanks.
The solution seem so simple but for a non-programmer noob like me, it would take me hours and still not find the solution.
Thanks!!
Hi there. I tried this process by uncommenting the three lines, uploading the file, callling it from a browser and after entering the login and password of inchoo/inchoo555 I’m given an ‘Access Denied’ error message.
I’ve tried other unique login/email/password names and get the same result every time.
Your help would be greatly appreciated.
Thanks.
p.s. I’m on 1.3 on my own server.
thank you very much. excellent!
THANKS dude, you are the best.
you’re awesome.
THANKS.
Hi,
Ive been looking for hours for something like this as i have done the stupid and locked myself out!
But when i run it i get the following error:
Parse error: syntax error, unexpected ‘@’, expecting ‘)’ in /home/wiretekc/public_html/newadmin.php on line 34
I confirm that the script works with 1.4. Good work guys!
@Michal: Good to know, thanks for the feedback
I found an easy solution at http://www.redstage.com/magento/blog/2010/03/11/magento-how-to-reset-the-admin-password/comment-page-1/?rcommentid=1782&rerror=incorrect-captcha-sol&rchash=6f992ca439d837af97d86bed798a2700#commentform
works great, just what I needed. Thank you!
I swear to god this site has helped me so much through the year with magento. You guys are great!!! I love this site alot and will always keep it as a bookmark. Thanx guys, this worked as always : )
Brilliant. Helped me out thanks.
AWESOME! I used it on a “Magento CE Version 1.4.1.1″ site and it worked great.
great works –> you’re better than magento guys
What could be easier than this!!
Worked great… unlike many things in Magento.
Thanks again!
Ivan,
Please send us a step by step (or print screen) explanation how to do it.
As Alvin says …for a non programmer it’s realy hard to understand.
So. please HELP
pls help, there isnt any php file inside the compressed file… i only get a “newadmin” file without extension, when open it in notepad i only get strange symbols…
I had to use opera to download the zip file. Internet Explorer would not open it as it said corrupted file. Worked great!
You saved my life, tnx
Please help. I cannot login to my admin panel. This occured after i went into Magento configurations and limited the admin role.
Now whenever I try to login, i get a message that says:
Parent Role id ‘G8′ does not exist (along with a bunch of code)
I tried logging in from a 2nd login that has “All” for Role and still no luck.
I tried several fixes that you listed including newadmin.php and still no luck.
The only message I get when I try newadmin.php is:
Email, User Name already exists
Any ideas would be much appreciated.
Thank you,
Hank
Excellent work Ivan, thanks!
Thank you so very much!
Thank you THANK YOU!!! I have been locked out of my account all day and the script worked on version 1.5.0.1!!! I love you man!!
I’m glad to hear that old tricks still work
Thanks it’s work fine
GREAT WORKT!!!
very useful script
so it works on Magento ver. 1.5.1.0
Thank you very much. We’ve spent all day trying the other “fixes” and nothing worked… even other “create new admin user” fixes.
Your script worked great! We’re back up and running. I wish we’d found it first and not after 12 hours of searching.
Great job..saved me a lot of time.. it alsoworks on Magento ver. 1.6.0.0
Lifesaver !!! works great @ 1.5.1.0
Susana it is used well. But im getting problem when looking to connect with the Magento connect…. im not only saying to susana but to all…. can you help me
Thank you! This script is a life saver! Works for me on Magento Community 1.6 and Magento Pro 1.11.