# How do I activate a user account via console?

**URL:** https://meta.discourse.org/t/how-do-i-activate-a-user-account-via-console/286191
**Category:** Development
**Tags:** rails-console
**Created:** [November 21, 2023, 11:47am UTC](https://meta.discourse.org/t/how-do-i-activate-a-user-account-via-console/286191 "2023-11-21T11:47:40Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [November 21, 2023, 2:15pm UTC](https://meta.discourse.org/t/how-do-i-activate-a-user-account-via-console/286191/2 "2023-11-21T14:15:46Z")

</div>

I don’t think there is a direct command for that, but you can use the Rails console.  
First, you enter into it:

```plaintext
cd /var/discourse
./launcher enter app
rail c

```

Then, you find the user by its username (replace `username_to_activate`) and activate it.

```plaintext
User.find_by(username: "username_to_activate").activate

```

You can type `exit` two times to quit.

You should see that action in the log:

![image](https://global.discourse-cdn.com/meta/optimized/4X/3/a/b/3ab79ddfa130e0673f159c898316d17938861c96_2_690x43.png)

---

_[View the full topic](https://meta.discourse.org/t/how-do-i-activate-a-user-account-via-console/286191)._
