smtpsync
Copy this server's SMTP configuration database to another GoAdmio server, replacing the one there, then rebuild the mail maps on that server
- Command:
/go/smtpsync - Category: Server sync
- Required arguments:
<remote-server>and<root-password> - Output: The file transfer progress. No final success message.
- Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · Security · See also
Overview
/go/smtpsync copies the global SMTP configuration database, /var/lib/sqlite/smtp.db, from this server to another GoAdmio server over SSH. Use it to keep a second server's SMTP settings the same as this one's, for example after you move accounts with copy or serversync.
After the copy, the command runs vmail on the remote server, so the Postfix and Dovecot mail maps are rebuilt there.
[!WARNING] The copy is one-way and replaces the database on the remote server. Anything that was only on the remote server's
smtp.dbis lost.
Quick start
/go/smtpsync 203.0.113.10 'RemoteRootPassword'
Syntax
/go/smtpsync <remote-server> <root-password> [ssh-port]
The command writes the call and a timestamp to /var/log/go/smtpsync.log. That log also contains the root password you typed. See Security.
Arguments
| Position | Argument | Required | Default | Notes |
|---|---|---|---|---|
| 1 | <remote-server> |
Yes | — | The host name or IP address of the other server. |
| 2 | <root-password> |
Yes | — | The root SSH password of the other server. Quote it in single quotes. |
| 3 | [ssh-port] |
No | 22 |
The SSH port of the other server. Pass it when the port was changed with port. |
Nothing is validated. A wrong server or password shows up only as an SSH or rsync error.
Output
The first line says which server is being used:
Copying WA to 203.0.113.10...
[!NOTE] The text says "WA", but the file copied is the SMTP database. The word is a leftover from a similar command and doesn't affect what happens.
After that, rsync shows the file name and the transfer progress, then any output of vmail from the remote server. There is no final message, so you can't tell from the output alone whether the copy worked. Check that the remote server's /var/lib/sqlite/smtp.db has a recent modification time.
Examples
# Copy to a server on the default SSH port
/go/smtpsync 203.0.113.10 'RemoteRootPassword'
# Copy to a server whose SSH port is 2222
/go/smtpsync backup.example.com 'RemoteRootPassword' 2222
# Review recent calls (this log contains the passwords)
tail /var/log/go/smtpsync.log
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
sshpass: command not found |
sshpass is not installed on this server. |
Install sshpass. |
Permission denied or rsync error ... (code 255) |
Wrong password, or the remote server doesn't allow root to log in with a password from this server. |
Check the password. Allow the login with permitrootlogin on the remote server. |
Connection refused, or it waits and times out |
Wrong port, or the remote firewall blocks SSH. | Pass the right port as the third argument. Open it with allow on the remote server. |
rsync: command not found on the remote side |
rsync is not installed on the remote server. |
Install rsync there. |
/go/vmail: No such file or directory |
The remote server is not a GoAdmio server. | Use a GoAdmio server. |
The copy failed, but vmail still ran |
vmail runs even when the copy fails. |
Fix the cause and run the command again. |
| The remote server lost its own SMTP settings | The database is replaced as a whole. | By design. Back up the remote file before you run it. |
Your password appears in /var/log/go/smtpsync.log |
The script logs every argument. | Delete the entry. See Security. |
Details
What it does
- Records the call, including the password, in the log.
- Uses port
22if no port was given. - Prints
Copying WA to <remote-server>.... - Copies
/var/lib/sqlite/smtp.dbto the same path on the remote server asroot, usingrsyncover SSH with the given password. File permissions, owner, and times are kept, and the data is compressed while it travels. - Runs
/go/vmailon the remote server over SSH.
flowchart TD
A["smtpsync server password [port]"] --> B["Log the call"]
B --> C["rsync smtp.db to root@server"]
C --> D["ssh to server: run /go/vmail"]
What is and isn't changed
| Item | Result |
|---|---|
/var/lib/sqlite/smtp.db on this server |
Not changed. |
/var/lib/sqlite/smtp.db on the remote server |
Replaced with a copy of this server's file. |
| Postfix and Dovecot mail maps on the remote server | Rebuilt by vmail. |
| Other files and databases | Not copied. |
The database is copied as a plain file while this server may be using it. If SMTP activity writes to it at that moment, the copy might be incomplete. Run the command at a quiet time, or run it again.
What is needed
sshpasson this server.rsyncon both servers.rootlogin with a password allowed on the remote server from this server's IP address.- GoAdmio installed on the remote server, so that
/go/vmailexists.
Security
- The remote root password is saved in plain text in
/var/log/go/smtpsync.log, because the script logs all of its arguments. - The password is visible while the command runs. It is part of the command line, so it can appear in the process list and in your shell history.
- The remote server's identity is not checked. The connection ignores the server's host key (
StrictHostKeyChecking=no), so someone who intercepts the connection could receive the root password. Only use it on a network you trust. - It needs
rootpassword login on the remote server, which many servers turn off for safety. Turn it back off, or restrict it to this server's IP, when you are done.
See also
| Command | Description |
|---|---|
vmail |
Rebuild the Postfix/Dovecot vmail maps |
smtp |
Manage the SMTP port: block, unblock, and change it |
serversync |
Copy a whole GoAdmio server to another server over SSH |
copy |
Copy one or all GoAdmio accounts to another GoAdmio server over SSH |
copymail |
Copy a domain's mailboxes to the same domain on another GoAdmio server |
sslsync |
Copy domain account SSL certificates from a local to a remote server |
mysqlsync |
Copy MySQL databases from a local to a remote server |
postgresync |
Copy PostgreSQL data to a remote server |
permitrootlogin |
Allow root SSH login from a specific IP |
port |
Change the default SSH port (22) to another port |