Short answer

To reset a forgotten DSpace admin password, sign in to the server and run sudo -iu dspace /dspace/bin/dspace user --modify --email admin@example.org --newPassword with the admin’s email. It asks for the new password twice and prints “Modified EPerson”. No email setup or web interface is needed. Tested on DSpace 10.1.

Tested on Ubuntu 26.04 and 24.04, two separate runs. On 24.04, every step is the same. Everything that differed

This lesson starts from a DSpace server set up as in Install DSpace: DSpace in /dspace, run by the dspace user, the REST API on localhost:8080. If yours lives elsewhere, change /dspace in the commands.

Step 1: Find the administrator’s email

DSpace signs people in by email. If you are not sure which email the administrator has, list every account:

Server
$ sudo -iu dspace /dspace/bin/dspace user --listeb700177-543d-4e69-9712-6d63999b4437	admin@example.org/null	Admin, Adad17c6f75-0c7e-48df-9b89-f3c83e58b577	editor@example.org/null	Editor, Eve
Output hidden (2 lines)

Each line is the account’s id, its email followed by / and its NetID (null when there is none), and the name. The test server had the administrator and one ordinary account.

Optional · makes the commands copy-paste ready

The email of the account you cannot sign in to, as `dspace user --list` prints it.

You can skip this: then replace admin@example.org with your own value in each command and file below before you run it. A value typed here stays in this browser only.

To see the problem from the server itself, without a browser, sign in through the REST API the web interface uses. It first fetches a CSRF token, then posts the email and password, and prints only the HTTP status:

Server
$ rm -f /tmp/ds.cookiesTOKEN=$(curl -s -c /tmp/ds.cookies -D - -o /dev/null http://localhost:8080/server/api/security/csrf | grep -i '^dspace-xsrf-token:' | cut -d' ' -f2 | tr -d '\r')curl -s -o /dev/null -w '%{http_code}\n' -b /tmp/ds.cookies -H "X-XSRF-TOKEN: $TOKEN" --data-urlencode 'user=admin@example.org' --data-urlencode 'password=[password]' http://localhost:8080/server/api/authn/login401
Output hidden (1 line)

401 means the email or the password is wrong. That is what a forgotten password looks like.

Step 2: Set a new password

Run the user tool as the dspace user with the email and --newPassword. It asks for the new password twice and shows nothing while you type:

Server
$ sudo -iu dspace /dspace/bin/dspace user --modify --email admin@example.org --newPasswordEnter new password for user 'admin@example.org':Enter new password again to verify:Modified EPerson eb700177-543d-4e69-9712-6d63999b4437
Output hidden (3 lines)

“Modified EPerson” and the account’s id mean the new password is saved. Nothing else about the account changes, and you do not need to restart anything: the next sign-in uses it.

If you see “Passwords do not match. Password not set”

The two passwords you typed differ. DSpace keeps the old password and says so with “No changes.”:

Server
$ sudo -iu dspace /dspace/bin/dspace user --modify --email admin@example.org --newPasswordEnter new password for user 'admin@example.org':Enter new password again to verify:Passwords do not match.  Password not setNo changes.
Output hidden (4 lines)

Run the same command again and type the same password twice. On the test server the old password still worked after this error.

If you see “No such EPerson”

No account has that email. DSpace stops before it asks for a password:

Server
$ sudo -iu dspace /dspace/bin/dspace user --modify --email nobody@example.org --newPasswordNo such EPerson
Output hidden (1 line)

Copy the email exactly as dspace user --list prints it (step 1). If the administrator account is really gone, make a new one with create-administrator (below).

Step 3: Check it worked

Optional · makes the commands copy-paste ready

Only for the check in step 3 and the second way: the reset itself asks for it at a prompt.

You can skip this: then replace [new-password] with your own value in each command and file below before you run it. A password typed here is kept only while this page is open, never saved or sent.

The same REST sign-in with the new password:

Server
$ rm -f /tmp/ds.cookiesTOKEN=$(curl -s -c /tmp/ds.cookies -D - -o /dev/null http://localhost:8080/server/api/security/csrf | grep -i '^dspace-xsrf-token:' | cut -d' ' -f2 | tr -d '\r')curl -s -o /dev/null -w '%{http_code}\n' -b /tmp/ds.cookies -H "X-XSRF-TOKEN: $TOKEN" --data-urlencode 'user=admin@example.org' --data-urlencode 'password=[new-password]' http://localhost:8080/server/api/authn/login200
Output hidden (1 line)

200: signed in. The old password now fails:

Server
$ rm -f /tmp/ds.cookiesTOKEN=$(curl -s -c /tmp/ds.cookies -D - -o /dev/null http://localhost:8080/server/api/security/csrf | grep -i '^dspace-xsrf-token:' | cut -d' ' -f2 | tr -d '\r')curl -s -o /dev/null -w '%{http_code}\n' -b /tmp/ds.cookies -H "X-XSRF-TOKEN: $TOKEN" --data-urlencode 'user=admin@example.org' --data-urlencode 'password=[old-password]' http://localhost:8080/server/api/authn/login401
Output hidden (1 line)

Now sign in to the web interface with the email and the new password. The REST check works the same with any web interface, or none.

The other way: create-administrator with an existing email

The command that made the first administrator also resets one. Given an email that already has an account, it does not make a second account: it sets the new password and adds that account to the Administrator group. Use it when the administrator account must be rebuilt, or to make an ordinary account an administrator. On the test server, an ordinary account:

Server
$ sudo -iu dspace /dspace/bin/dspace create-administrator -e editor@example.org -f Eve -l Editor -c en -p '[new-password]'Administrator account created
Output hidden (1 line)

The message says “created”, but the list shows the same accounts, with the same ids, as before:

Server
$ sudo -iu dspace /dspace/bin/dspace user --listeb700177-543d-4e69-9712-6d63999b4437	admin@example.org/null	Admin, Adad17c6f75-0c7e-48df-9b89-f3c83e58b577	editor@example.org/null	Editor, Eve
Output hidden (2 lines)

And that account signed in with the password given to -p (the check saw 200). The source shows why: it looks the email up first and only creates an account when none exists (see “Checked against the source” in the Tested on box).

Troubleshooting

  • Passwords do not match. Password not set: the two entries differed; nothing changed. Run it again. Details.
  • No such EPerson: no account has that email. Copy it from dspace user --list. Details.
  • The REST sign-in prints 401 after the reset: the email or the new password is mistyped (the email is the whole address, as listed). Details.
  • No administrator account is left at all: create-administrator with a new email makes one. Details.

What these steps changed on the server

Both runs recorded the server before the first step and after the last (see the Tested on box below): no package, no service and no file under /etc changed; only DSpace’s database (the two accounts’ passwords and the Administrator group) and its log files, about 19 MB of disk in all.

Ubuntu 26.04 vs 24.04

The same check ran on a fresh 26.04 server and on a fresh 24.04 server, each with its own run log. Every command printed the same on both, apart from the accounts’ ids.

WhatUbuntu 26.04Ubuntu 24.04
SystemUbuntu 26.04.1 LTS7.0.0-43-genericUbuntu 24.04.5 LTS6.8.0-149-generic
openjdk-21-jdk-headless21.0.13.1+2-1~26.04.121.0.13.1+2-1~24.04.1
maven3.9.12-1not installed
ant1.10.15-1build11.10.14-1
postgresql-1717.12-1.pgdg26.04+1not installed
dspace10.110.1
solr9.11.09.11.0
postgresql-16not installed16.15-0ubuntu0.24.04.1
Commands and resultsThe same on every release: the same commands, the same results.
ProofRun log, 30 checks passedRun log, 30 checks passed