Create an admin account from the console

So you want to create/grant Admin privileges or reset user password from console? Great, let’s get started!

Access Console

Connect to your Droplet via SSH, or use Putty on Windows:

ssh root@192.168.1.1

Replace 192.168.1.1 with the IP address of your Droplet.

Switch to your Discourse folder:

cd /var/discourse

Enter the container:

./launcher enter app

Create New Account with Admin Privileges

Run this command from console:

rake admin:create
instructions for multisite

If you have a multisite configuration you’ll do

RAILS_DB=my_site_db rake admin:create 

You will be asked for Email, Password and Confirm Password.

After providing required information a new account will be created with random username (based on email address).

Now you will be asked: Do you want to grant Admin privileges to this account? (Y/n). Press enter to continue.

If it worked, you’ll see Your account now has Admin privileges!.

Reset Password for Existing Account

Run this command from console:

rake admin:create

You will be asked for Email, enter the email of an existing account.

Now you will be asked: User with this email already exists! Do you want to reset the password for this email? (Y/n). Press enter to continue.

Provide the new password and confirm password.

If it worked, you’ll see Account updated successfully!.

Grant Admin Privileges to Existing Account

Run this command from console:

rake admin:create

You will be asked for Email, enter the email of existing account.

Now you will be asked: User with this email already exists! Do you want to reset the password for this email? (Y/n). Press n then enter.

Now you will be asked: Do you want to grant Admin privileges to this account? (Y/n). Press enter to continue.

If it worked, you’ll see Your account now has Admin privileges!.


Last Reviewed by @AlexDev on 2022-05-26T00:00:00Z

50 Likes