Categories
Docker

Reset admin account in Seafile Docker

Last week I have set up Seafile on my local network (using Docker) and installed the SeafilePro mobile app on my phone. I was happy that I could make it work on the first try and I backed up a bunch of stuff on the server.

Today I realised that since I was “just testing” Seafile, I had used a random password and not saved it in my password manager. And no, I didn’t have a mail server running on the Seafile Docker container to reset my password directly.

After digging around the docs a bit, I realised it was super simple to reset a super-admin on Seafile – you have to run a script called reset-admin.sh from the Seafile docker container.

Here’s a short video to help you follow along the rest of the tutorial:

Let’s see what containers are running:

▶ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2aefada0816e seafileltd/seafile-mc:8.0.4 "/sbin/my_init -- /s…" 24 hours ago Up 24 hours 0.0.0.0:8089->80/tcp seafile
7607efca169f mariadb:10.5 "docker-entrypoint.s…" 24 hours ago Up 24 hours 3306/tcp seafile-mysql
716bc9ae26f3 memcached:1.5.6 "memcached -m 256" 24 hours ago Up 24 hours 11211/tcp seafile-memcached

There are three containers running Seafile – The seafile, seafile-mysql and seafile-memcached. We need get into the seafile container to find the reset-admin.sh script in the /opt/seafile/seafile-server-latest directory.

▶ docker exec -it seafile bash
[email protected]:/opt/seafile# cd seafile-server-latest
[email protected]:/opt/seafile/seafile-server-latest# ls -l
total 156
-rw-r--r-- 1 root root 10899 Mar 24 10:06 check_init_admin.py
-rwxr-xr-x 1 root root 1805 Mar 24 10:06 reset-admin.sh
drwxr-xr-x 1 root root 4096 Apr 13 18:24 runtime
-rwxr-xr-x 1 root root 1746 Mar 24 10:06 seaf-fsck.sh
-rwxr-xr-x 1 root root 3134 Mar 24 10:06 seaf-fuse.sh
-rwxr-xr-x 1 root root 2641 Mar 24 10:06 seaf-gc.sh
drwxr-xr-x 1 root root 4096 Mar 24 10:06 seafile
-rwxr-xr-x 1 root root 4581 Mar 24 10:06 seafile.sh
drwxr-xr-x 1 root root 4096 Mar 23 12:42 seahub
-rwxr-xr-x 1 root root 7906 Mar 24 10:06 seahub.sh
-rw-r--r-- 1 root root 56437 Mar 24 10:06 setup-seafile-mysql.py
-rwxr-xr-x 1 root root 1548 Mar 24 10:06 setup-seafile-mysql.sh
-rwxr-xr-x 1 root root 22087 Mar 24 10:06 setup-seafile.sh
drwxr-xr-x 4 root root 4096 Dec 30 08:04 sql
drwxr-xr-x 1 root root 4096 Dec 30 08:06 upgrade

Once we reach in this directory, we can then run the reset-admin.sh script which will ask you for your email address. Use the same email address that you created your account with. Then enter your password and confirm the password.

[email protected]:/opt/seafile/seafile-server-latest# ./reset-admin.sh
E-mail address: [email protected]
Password:
Password (again):
Superuser created successfully.

And you’re done! You can now log in with the new credentials!