# Activate/confirm first admin upon fresh installation through command line

**URL:** https://meta.discourse.org/t/activate-confirm-first-admin-upon-fresh-installation-through-command-line/229012
**Category:** Self-hosting
**Created:** [June 4, 2022, 3:25pm UTC](https://meta.discourse.org/t/activate-confirm-first-admin-upon-fresh-installation-through-command-line/229012 "2022-06-04T15:25:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [June 4, 2022, 3:25pm UTC](https://meta.discourse.org/t/activate-confirm-first-admin-upon-fresh-installation-through-command-line/229012/1 "2022-06-04T15:25:38Z")

</div>

Continuing the discussion from [Activating admin account from console](https://meta.discourse.org/t/activating-admin-account-from-console/79146):

> [@Activating admin account from console](https://meta.discourse.org/t/activating-admin-account-from-console/79146/1):
>
> ```plaintext
> 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)
> 
> ```

Looks like this is not working anymore:

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

What would be the way to do it nowadays?

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [June 4, 2022, 3:38pm UTC](https://meta.discourse.org/t/activate-confirm-first-admin-upon-fresh-installation-through-command-line/229012/2 "2022-06-04T15:38:19Z")

</div>

I found the answer [here](https://meta.discourse.org/t/activating-admin-account-from-console/79146/5)

> [@Activating admin account from console](https://meta.discourse.org/t/activating-admin-account-from-console/79146/5):
>
> This worked great! Note that the `rails c` is not necessary for running the rake commands.
> 
> > [@](#):
> >
> > ```plaintext
> > . /launcher enter app
> > rake admin:create
> > 
> > ```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 4, 2022, 3:38pm UTC](https://meta.discourse.org/t/activate-confirm-first-admin-upon-fresh-installation-through-command-line/229012/3 "2022-07-04T15:38:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
