# Activating admin account from console

**URL:** <https://meta.discourse.org/t/activating-admin-account-from-console/79146>\
**Category:** Self-hosting\
**Created:** [January 27, 2018, 9:46am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146 "2018-01-27T09:46:20Z")\
**Posts on this page:** 9\
**Page:** 1

## AI-generated summary

The discussion revolves around activating an admin account in Discourse when email setup fails during installation. [gpritiranjan](/t/-/79146/1) encountered issues with email delivery and sought help to activate the admin account via the console. [mpalmer](/t/-/79146/2) clarified that pressing `q` after the `rails c` prompt allows continuation of commands. [pfaffman](/t/-/79146/4) recommended using `rake admin:create` as a more reliable method, which was confirmed by [deltamotion](/t/-/79146/5) and [JammyDodger](/t/-/79146/7). [fishfree](/t/-/79146/6) initially faced an error but later found a solution through an external guide, highlighting that the `rails c` step is unnecessary for `rake admin:create`. The thread emphasizes the preferred method for admin creation and troubleshooting console access.

<div class="post-metadata">

**Author:** ![gpritiranjan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gpritiranjan/32/88408_2.png) [@gpritiranjan](https://meta.discourse.org/u/gpritiranjan)\
**Post date:** [January 27, 2018, 9:46am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/1 "2018-01-27T09:46:20Z")

</div>

I am trying to setup Discourse with one-click installer using droplet over Digital Ocean. I followed all the instructions and have correctly configured the SMTP details. But when I register for the admin account using the front-end installer, I am not able to receive the email.

I read a tutorial where it is mentioned that if the email doesn’t land in the mailbox, I can still activate the account and set the user as admin using the following commands using the console:

```
cd /var/discourse
sudo ./launcher enter app
rails c
user = User.find_by_email("<admin_email>")
user.admin = true
user.approved = true
user.save
EmailToken.confirm(user.email_tokens.first.token)

```

I am able to run the commands up to the fourth line. After running the fourth command, it finds and displays the user details. But I am not able to enter the next command. There’s this colon “:” and when I reach the end of the displayed details, “(END)” is written. I can’t type and run the further commands to activate the user.

After rails c, there’s this [1] pry (main) \> thing. I am not so much acquainted with the command line. Please help me out.

---

<div class="post-metadata">

**Author:** ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)\
**Post date:** [January 27, 2018, 10:55am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/2 "2018-01-27T10:55:56Z")

</div>

When the colon appears, press `q` to get back to a prompt, and type the next command.

---

<div class="post-metadata">

**Author:** ![gpritiranjan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gpritiranjan/32/88408_2.png) [@gpritiranjan](https://meta.discourse.org/u/gpritiranjan)\
**Post date:** [January 27, 2018, 11:31am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/3 "2018-01-27T11:31:49Z")

</div>

Thanks. It resolved the issue.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [January 27, 2018, 1:47pm UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/4 "2018-01-27T13:47:37Z")

</div>

If you’re not receiving mail, then mail is not correctly configured.

You seem to have solved your account creation problem, but the recommended way to create an admin account and password is

. /launcher enter app  
rails c  
rake admin:create

That will allow you to

- create an account
- change an account password
- assign admin to an account

---

<div class="post-metadata">

**Author:** ![deltamotion](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@deltamotion](https://meta.discourse.org/u/deltamotion)\
**Post date:** [March 26, 2019, 7:20pm UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/5 "2019-03-26T19:20:58Z")

</div>

This worked great! Note that the `rails c` is not necessary for running the rake commands.

> [@pfaffman](#):
>
> . /launcher enter app  
> rake admin:create

---

<div class="post-metadata">

**Author:** ![fishfree](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fishfree/32/235911_2.png) [@fishfree](https://meta.discourse.org/u/fishfree)\
**Post date:** [April 18, 2023, 5:44am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/6 "2023-04-18T05:44:38Z")

</div>

I cannot activate the admin account according your post in the latest version. Error occured at the last command:

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/f/0/2f0eaabcde10a956e1b6eb0d4cfa47374116ce9a.png)

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [April 18, 2023, 6:03am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/7 "2023-04-18T06:03:33Z")

</div>

The current way to create an admin via the console is to:

```plaintext
./launcher enter app
rake admin:create

```

---

<div class="post-metadata">

**Author:** ![fishfree](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fishfree/32/235911_2.png) [@fishfree](https://meta.discourse.org/u/fishfree)\
**Post date:** [April 18, 2023, 6:06am UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/8 "2023-04-18T06:06:25Z")

</div>

I just found solution here:[Discourse Admin Quick Start Guide](https://www.phylobabble.org/t/discourse-admin-quick-start-guide/3/)

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [June 8, 2024, 12:36pm UTC](https://meta.discourse.org/t/activating-admin-account-from-console/79146/9 "2024-06-08T12:36:43Z")

</div>

Closed on June 8, 2024, 12:36pm UTC

This topic was automatically closed after 2324 days. New replies are no longer allowed.
