Reset Admin Password

I forgot the admin password, How to reset it, Please help.

I installed mailinabox few weeks ago and it did not worked for me.
Now I explored documentation and executed command sudo mailinabox and it worked.
Finally I can see login screen now. But Now I forgot the admin password. Please tell me how to reset it.
What is the path of password file?
I have root access to server.

Thanks in Advance

Log into the box using SSH (same as when you set up the box). Then run:

sudo /root/mailinabox/tools/ user password

Replacing with the email address that you created when you created the box (or whatever your admin account email address is).


sudo /root/mailinabox/tools/

for a full list of commands.


That solved my issue.

Thank you a lot for quick support. Mail-in-a-box is very usefull package and This forum gives best support
Thanks again

Hello, I am having the same issue … I have forgotten the admin password.

When following the instructions in this post I get the following:

Traceback (most recent call last):
File “./mailinabox/tools/”, line 99, in
print(mgmt("/mail/users/password", { “email”: email, “password”: pw }))
File “./mailinabox/tools/”, line 9, in mgmt
File “./mailinabox/tools/”, line 47, in setup_key_auth
key = open(’/var/lib/mailinabox/api.key’).read().strip()
PermissionError: [Errno 13] Permission denied: ‘/var/lib/mailinabox/api.key’

Can anyone offer some help? Thanks in advance!

Run with sudo! the last line tells you the problem “PermissionError” means you ran the command as normal user. Run with Root.

sudo ./home/username/mailinabox/tools/ user password

I think @murgero is correct that this is a permissions issue, but the path in the command s/he gave is incorrect. See @JoshData’s earlier post for the correct command, and ensure you include sudo at the start.

@sdlg My command is correct for my system. “username” is replaced with the users login name, Since I do not use root to login, when I install MIAB it’s tools and scripts are put in /home/username/mailinabox" but if doing it directly from the root account it will be in /root/mailinabox.

Great. For everyone who isn’t logged into your Box, though, @JoshData’s answer is correct.

I am not denying @JoshData’s answer, I just followed the install instructions and that is how it was installed for me. For most people, I would assume the same unless using a VPS with only root access. :slight_smile: Cheers!

Logged in a standard user with sudo privilege and in my /home folder I had to run

sudo mailinabox/tools/ user password 

I was receiving the following

sudo: /root/mailinabox/tools/ command not found

Then …

sudo /home/username/mailinabox/tools/ user password

substitute username with the system user account that you used when installing MiaB.

1 Like

I am also trying to rest my mail in box admin password using the steps above (sudo mailinabox/tools/ user password but i am getting the following error - /root/mailinabox/tools/ line 3: management/ No such file or directory

I think this script might have moved to:


Looking at comment in the new script on GitHub

# This is a command-line script for calling management APIs
# on the Mail-in-a-Box control panel backend. The script
# reads /var/lib/mailinabox/api.key for the backend's
# root API key. This file is readable only by root, so this
# tool can only be used as root.
1 Like

The key question is if you installed MiaB using root or using a sudo user?

You have to adjust your path relative to the user which was used to install MiaB initially.

My comment might be a red herring then?