mailpwd
Give every email account of one domain a new password (a different random one for each, or one password you choose for all), print the results, and restart the mail services
- Command:
/go/mailpwd - Category: Mail
- Required argument: the domain
- Output: One
email | passwordline per account - Log:
/var/log/go/mailpwd.log - Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · Security · See also
Overview
/go/mailpwd resets the passwords of all email accounts of a domain in one go. It is useful after a security incident, such as a hacked mailbox or a spam campaign, when every account should get a new password.
For each account on the domain, the command:
- chooses a new password
- saves it in GoAdmio
- updates the login that Dovecot uses
- prints the address and the new password
It then restarts the mail services. To change just one account, use mail with --action edit.
[!WARNING] Every user is locked out until you give them the new password. The passwords are shown only on screen, so save the output right away. See Security.
Quick start
# New random password for every account of example.com
/go/mailpwd example.com
Syntax
/go/mailpwd <domain> [password]
| Form | Behavior |
|---|---|
/go/mailpwd <domain> |
Each account gets its own random 16-character password (letters and numbers). |
/go/mailpwd <domain> <password> |
Every account gets the same password you give. |
Arguments
| Position | Argument | Required | Notes |
|---|---|---|---|
| 1 | <domain> |
Yes | A hosted domain that isn't in the trash. |
| 2 | [password] |
No | One password for all accounts. Avoid spaces and single quotes (') in it. |
There are no --option value pairs.
Output
Change Multiple Email Account Passwords
info@example.com | k3JdP9xQw2LmZ8Ta
sales@example.com | Vb7RtN4yHs1CqE6u
support@example.com | Xe2MfG5pWd9AaKz3
The command prints a heading, then one line per account. Nothing else is shown while the mail services restart.
| Situation | Message |
|---|---|
| The domain isn't hosted, or is in the trash | Account Domain <domain> not exists, exit status 1. (See Known limitations: this check doesn't work on Debian and Ubuntu.) |
| The domain has no email accounts | Only the heading is printed, and the services are still restarted. |
Examples
# Reset all accounts and keep the passwords in a private file
(umask 077; /go/mailpwd example.com > /root/example.com-passwords.txt)
# Give all accounts the same temporary password
/go/mailpwd example.com 'Temp-Pass-2026'
# Remove the temporary list of addresses the command leaves behind
rm /usr/local/goadmio/example.com.email
# Look up a password later in GoAdmio's database
sqlite3 /var/lib/sqlite/mail.db "select Email,Pass from Mail where Domain='example.com'"
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Account Domain <domain> not exists |
The domain isn't hosted here, is misspelled, or is in the trash. | Check the name with the account list. |
[[: not found on Debian or Ubuntu |
The script is started with sh, which doesn't understand that test. The domain check is then skipped. |
See Known limitations. Pass an existing domain. |
| Users can't log in | Their passwords were changed. | Send them the new passwords. |
| You didn't save the output | The passwords are printed once. | Read them from the Mail table (see the examples above), or run the command again. |
A password with a space or ' fails |
The value isn't quoted when it is passed on. | Use a password with letters, numbers, and simple symbols only. |
| An account on another domain stopped working | See Known limitations: its entry in Dovecot's password file can be deleted by mistake. | Set a password for that account with mail --action edit. |
| Mail was briefly unavailable | The mail services are restarted at the end. | Expected. Run it at a quiet time. |
/usr/local/goadmio/<domain>.email exists |
The list of addresses is left behind. | Delete it. |
Details
How it works
flowchart TD
A["mailpwd domain [password]"] --> B{"Domain hosted?"}
B -- "No" --> X["Print error, exit 1"]
B -- "Yes" --> C["List the domain's email accounts"]
C --> D["For each account"]
D --> E["Pick a new password"]
E --> F["Save it in the Mail database"]
F --> G["Print email and password"]
G --> H["Replace its line in Dovecot's password file"]
H --> D
D --> I["Rebuild Postfix tables, restart mail services"]
- Logs the call (including any password you passed) to
/var/log/go/mailpwd.log. - Prints the heading.
- Checks that the domain exists in the
Sitetable and isn't in the trash. - Writes the domain's email addresses to
/usr/local/goadmio/<domain>.email. - For each address, uses the password you gave, or generates a random 16-character one.
- Saves it in the
Mailtable of/var/lib/sqlite/mail.db. - Prints
<email> | <password>. - Deletes the account's line from
/etc/dovecot/passwd, and adds a new line with the SHA1 hash of the password. - After the last account, runs
postmaponcustom_replies,vmail_domains,vmail_mailbox, andvmail_aliasesin/etc/postfix/. - Restarts
postfix,dovecot,saslauthd, andopendkim.
Suspended accounts are included. The command doesn't change anything outside the mail accounts of the domain you name.
Files used
| File | Purpose |
|---|---|
/var/lib/sqlite/mail.db |
The Mail table: the email accounts and their passwords. |
/var/lib/sqlite/site.db |
Used to check that the domain exists. |
/etc/dovecot/passwd |
Dovecot's logins. Each account's line is replaced. |
/usr/local/goadmio/<domain>.email |
A temporary list of the domain's addresses. It is not deleted afterwards. |
/var/log/go/mailpwd.log |
A log of each call. |
Known limitations
- The domain check fails on Debian and Ubuntu. The script starts with
#!/bin/sh, but it uses[[ ... ]], whichdashdoesn't have. The check prints[[: not foundand is skipped, so a missing domain isn't reported. Starting it with#!/bin/bashfixes this. - A Dovecot line can be removed by mistake. The line for each address is deleted by matching the start of the line, without the
:that follows it. An account such asa@example.comalso matchesa@example.com.au, so the other account's login is deleted. - Not all services are restarted. Unlike
mail restart, this command doesn't restartpostfwdandopendmarc, and it runspostmapwithout checking that each file exists. - Passwords are passed on unquoted. A password with spaces or special characters can break the commands that hash it.
- The database password is read but never used. The script reads GoAdmio's database password from
config.phpand doesn't use it. - The temporary address list stays behind.
Security
- The passwords are printed in plain text. Save them somewhere safe and private, and tell users to change them.
- The same password for everyone is weak. A password you pass as the second argument is given to all accounts.
- A password you pass is logged in plain text in
/var/log/go/mailpwd.log. It also appears in the process list and your shell history while the command runs. - GoAdmio stores the passwords in plain text in the
Mailtable. Dovecot's password file holds an unsalted SHA1 hash. - Keep
/var/log/go/,/var/lib/sqlite/, and/usr/local/goadmio/readable by root only.
See also
| Command | Description |
|---|---|
mail |
Add, edit, suspend, unsuspend, or delete an email account |
vmail |
Rebuild the Postfix/Dovecot vmail maps |
restoremail |
Recreate mail accounts from folders on disk |
outlook |
Send IMAP/SMTP configuration to email accounts |
troubleshoot |
Troubleshoot email problems in GoAdmio |
mailtop |
Check the most active email accounts in GoAdmio |