Migrate users from a Marzban database backup into a running PasarGuard instance.
Proxy UUIDs and passwords are carried over as-is, so existing subscription links continue to work after migration without any client-side changes.
- A full Marzban SQL dump (exported via phpMyAdmin,
mariadb-dump, ormysqldump) - PasarGuard running with a MariaDB or MySQL container
- The target admin account must already exist in PasarGuard
Download the script to your server:
curl -O https://raw.githubusercontent.com/AsanFillter/MarzPort/master/marzport.sh && chmod +x marzport.shThen open marzport.sh, fill in the configuration section, and run it:
bash marzport.shOpen marzport.sh and fill in the values at the top:
MYSQL_ROOT_PASS="" # MYSQL_ROOT_PASSWORD from your .env
MARZBAN_ADMIN="" # Admin username as it appears in the Marzban backup
PASARGUARD_ADMIN="" # Admin username in PasarGuard (can be the same)
BACKUP_FILE="" # Full path to the Marzban SQL dump on this server
DB_CONTAINER="" # MariaDB/MySQL Docker container name
TARGET_DB="pasarguard" # PasarGuard database name (default: pasarguard)
# Optional — required for automatic node sync after migration
PASARGUARD_URL="" # e.g. https://panel.example.com
SUDO_USERNAME="" # a sudo admin username
SUDO_PASSWORD="" # that sudo admin's passwordTo find your container name:
docker psThe script will show a summary of how many users will be migrated and ask for confirmation before making any changes.
- Imports the Marzban SQL backup into a temporary database
- Looks up the admin IDs in both Marzban and PasarGuard
- Temporarily disables the admin account to prevent external bots from deleting newly migrated users during the process
- Inserts all users, converting Marzban's schema to PasarGuard's format
- Assigns users to the first available group in PasarGuard
- Re-enables the admin account
- (If API credentials are set) Calls the PasarGuard API to disable then re-enable all migrated users, which pushes their configs to all connected nodes
- Updates the admin's traffic stats and drops the temporary database
If PASARGUARD_URL, SUDO_USERNAME, and SUDO_PASSWORD are not set, the node sync step is skipped. In that case, restart PasarGuard manually after migration:
pasarguard restart- Users that already exist in PasarGuard (matched by username) are skipped — safe to run multiple times
- Supports MariaDB and MySQL databases
- If the script fails at any point, the admin account is automatically re-enabled