vmware-marketplacediscourse

Modify the default administrator email address

During the deployment of Discourse, the administrator email used by default is user@example.com. As the administrator user, you most likely want to change it to your personal email address.

Changing the default administrator email requires an email verification from the current user@example.com email address, which is not possible from the Discourse settings panel. To do so, you need to perform some queries in the PostgreSQL database.

Follow the steps below in order to change the default administrator email in Discourse:

  • Log in to the server console. Learn how to connect to the server through SSH.

  • Enter the Rails console. Run the commands below:

      $ cd /opt/bitnami/discourse
      $ RAILS_ENV=production bundle exec rails c
    

    A new prompt should appear, as shown below:

      irb(main):001:0>
    
  • At the prompt, run the following commands to change the email address of the default user account to a new email address. Replace the EMAIL_ADDRESS placeholder in the commands below with your desired email address:

      u = User.find_by_username("user")
      u.email = "YOUR_NEW_EMAIL_ADDRESS"
      u.email_tokens.create(email: u.email)
      u.activate
      u.save!
    

The default administrator email address will be changed. You can verify the changes in your application admin panel:

  • In the top right menu, click the “Hamburger” button and select the “Admin” option.

    Discourse admin panel

  • Navigate to the “Users” section. You can check that the email associated with the admin user has changed:

    Discourse default admin email changed

Last modification February 9, 2023