What's the story?

It has happened to most of us when working with Umbraco, you can't remember the login details for the main admin account. You didn't realise when you were entering the details on the setup screens, you were entering username and password details that you would need it later to log in to Umbraco.

This post gives you 4 simple steps to help you reset the Umbraco admin password.

Step 1

Open SQL Server Management Studio
Create a new query using the database for your umbraco project. Copy and paste the following SQL:

UPDATE umbracoUser SET userdisabled = 0, userLogin = 'admin', userPassword = 'default' WHERE id = 0

Run the query. This has now made sure the admin account is enabled and and set the password to 'default'.

This won't work yet though as passwords are stored as hash values, so you need to edit a setting in the web.config file temporarily.

Step 2

In the web.config file, at the root of your web project, use Ctrl+F to find UsersMembershipProvider

The passwordFormat will be set to "Hashed". You need to change it to "Clear" so that you can login. Save the web.config file.

Step 3

Go to the umbraco login page and login with the username of admin and the password of default.

Once you have logged in, you need to change the passwordFormat in the web.config again back to "Hashed" and press Save.

Step 4

Now you can change the password for the admin user to a different one and it will be saved in the database with a hashed value instead of clear text.

To make sure it is storing passwords in the hashed format, run this SQL query after you have changed the password.

SELECT userName, userPassword FROM umbracoUser WHERE id = 0

You should see the admin username and the hashed password.

UPDATE

Since publishing this post, I have found there is an even easier way to reset the admin password. You can just add a dll to the bin folder. See this package

Paul Seal

Umbraco MVP and .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.

Proudly sponsored by

Moriyama

  • Moriyama build, support and deploy Umbraco, Azure and ASP.NET websites and applications.
AppVeyor

  • CI/CD service for Windows, Linux and macOS
  • Build, test, deploy your apps faster, on any platform.
stkrs

  • Custom stickers for startups, artists and brands.
  • Bespoke easy-apply, removable, custom brand stickers printed in the UK.
elmah.io

  • elmah.io is the easy error logging and uptime monitoring service for .NET.
  • Take back control of your errors with support for all .NET web and logging frameworks.
uSync Complete

  • uSync.Complete gives you all the uSync packages, allowing you to completely control how your Umbraco settings, content and media is stored, transferred and managed across all your Umbraco Installations.