No internet connection
  1. Home
  2. Support

How to reset admin password?

By Niraj Khanal @nkhanal0
    2020-05-29 13:31:31.196Z

    I forgot my admin password. Is there a way for me to reset it via Postgres or something? I had not configured the email server so the forgot password doesn't work.

    Linked from:

    1. support-chat
    • 4 replies
    1. Hi Niraj, yes there's a script for that, located at /opt/talkyard/scripts/find-admin-login-link.sh,

      it's this script: https://github.com/debiki/talkyard-prod-one/blob/master/scripts/find-admin-login-link.sh

      It works like this:

      1) you go here: https://your-ty-server/-/admin-login and type the admin email address (although you didn't configure an email server yet).

      2) login as root and run the script. It'll look at the emails Talkyard attempted to send, find the link, and print it to the console.

      3) Paste the link into a web browser. (It's a works-just-once link.)

      (If you don't remember the admin email address, you can run the script first and it'll print the admin email addresses.)

      1. N
        In reply tonkhanal0:
        Niraj Khanal @nkhanal0
          2020-05-29 15:39:50.489Z

          Hello @KajMagnus, Thank you for your reply. I did try that and was able to login however, couldn't find a way to reset my password. I have to do this all the time when I need to login. Is there a way to make it work so that I can manipulate Postgres? I looked into the table and it seems like the passwords are hashed using scrypt. Is there a way to reset it from the database itself? Or if I drop that row, and restart all servers, can I get those resolved? Thank You.

          1. Hi Niraj, I just edited the script a bit, so it'll find reset-password links too.

            Here: https://github.com/debiki/talkyard-prod-one/blob/master/scripts/find-admin-login-link.sh

            You can Git fetch it: git fetch and git merge --ff-only — but then you might need to resolve Git conflicts.
            Or just downolad it and chmod.

            Then, go here: https:// your server /-/users/ your_username /preferences/about and click Change next to Password.
            The server will try to send you an email, which won't work — but you can run the script, and it'll find and print the reset password link.

            1. In reply tonkhanal0:

              I looked into the table and it seems like the passwords are hashed using scrypt. Is there a way to reset it from the database itself?

              Yes, scrypt. Actually you could run an SQL statement that sets the password to cleartext:new_unsafe_password, but that's not a good idea since then the password wouldn't be hashed. cleartext: is just for some auto test suites (no way to set such a password via the GUI, only by hacking via SQL). But one cannot export and import a database with such unsafe passwords (the server rejects them during import)