How do I activate a user account via console?

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

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

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

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

You can type exit two times to quit.

You should see that action in the log:

4 Likes