Skip to content

Migrating from Plesk Obsidian to cPanel/WHM — the reverse path

Move accounts off Plesk Obsidian onto cPanel/WHM. There is no official Migrator in this direction — the runbook below covers what you actually need to script.

You’re consolidating two control panels onto cPanel/WHM because the rest of your fleet runs cPanel and the licensing finally lined up that way. The Plesk Migrator only goes one direction — into Plesk. There’s no plesk2cpanel tool. You’re going to script this yourself, and the first time you do it, you’ll discover that cPanel’s account-import format is rigid: it expects a cpmove-<user> tarball with a specific tree inside, and if anything is misnamed it silently skips that part of the import. This runbook walks the reverse migration end-to-end: how to build the cpmove tarball from Plesk, how to import it, and how to clean up the inevitable mismatches.

What’s happening

cPanel has a documented import format — the cpmove archive — that /scripts/restorepkg and /scripts/restoreacct consume. The archive has a known layout: <user>/homedir/, <user>/mysql/, <user>/mail/, <user>/cron, <user>/dnszones/, plus a meta directory with quotas, owner, and resold-by data. cPanel’s own pkgacct tool builds this from a live cPanel account. There is no equivalent on Plesk. You have to build the archive yourself, mapping Plesk’s data model (subscription + domain + mailname + db rows in the psa MySQL database) into cPanel’s flat per-user tree.

The mapping is mostly straightforward. Plesk subscription owner maps to cPanel user. Plesk subscription primary domain maps to cPanel primary domain. Plesk addon domains map to cPanel addon domains. Mailboxes under each domain map to cPanel mail accounts in /home/<user>/mail/<domain>/<localpart>/. MySQL databases get renamed from Plesk’s <owner>_<db> to cPanel’s <user>_<db> (the prefix convention is the same, so this is often a no-op).

The parts that don’t map cleanly are: PHP-FPM pool configs (Plesk uses per-domain FPM pools, cPanel uses EasyApache PHP-FPM with a different pool structure), NodeJS apps deployed through Plesk’s NodeJS extension (cPanel has Application Manager, but the deployment format differs), Plesk’s Git extension repositories (need to be re-initialized in cPanel’s Git Version Control), and Docker containers deployed through the Plesk Docker extension (cPanel has no Docker equivalent — these are out of scope for the migration).

How to verify

Source inventory on the Plesk host:

# Subscription count + primary domain
plesk bin subscription --list

# Database accounting
plesk db -Ne "SELECT d.name, db.name, db.type, dbu.login \
  FROM domains d \
  JOIN data_bases db ON db.dom_id=d.id \
  LEFT JOIN db_users dbu ON dbu.db_id=db.id \
  WHERE d.parentDomainId=0"

# Mail accounts per subscription
plesk db -Ne "SELECT d.name AS domain, m.mail_name AS mailbox, mn.quota \
  FROM mail m \
  JOIN domains d ON d.id=m.dom_id \
  LEFT JOIN mail_names mn ON mn.mail_id=m.id"

# PHP version per subscription
plesk bin domain --info $(plesk bin subscription --list | head -1) | grep PHP

Target on the cPanel/WHM host:

# cPanel version + license
/usr/local/cpanel/cpanel -V

# Confirm restorepkg / restoreacct are present
which /scripts/restoreacct /scripts/restorepkg

# Available PHP versions
whmapi1 php_get_installed_versions | jq -r '.data.versions[]'

# Free disk
df -h /home

The fix

Four phases: build the inventory, build per-user cpmove tarballs on Plesk, restore them on cPanel/WHM, run a delta pass to fix the parts that don’t import cleanly.

Phase 0 — Pre-flight inventory

Run this on the Plesk source as root. It maps every Plesk subscription to a cPanel-style user identifier and outputs a manifest:

#!/usr/bin/env bash
# /root/plesk-source-inventory.sh
set -euo pipefail

[[ "$(id -u)" -ne 0 ]] && { echo "Run as root."; exit 1; }
OUT="/root/plesk-inventory-$(date +%Y%m%d).json"

echo '{"generated_at":"'$(date -Iseconds)'","subscriptions":[' > "$OUT"
FIRST=1

# Get all subscription primary domains
SUBS=$(plesk db -Ne "SELECT name FROM domains WHERE parentDomainId=0 AND webspace_id=0")

for D in $SUBS; do
  [[ "$FIRST" -eq 0 ]] && echo "," >> "$OUT"
  FIRST=0

  # System user that owns this subscription
  SYS_USER=$(plesk db -Ne "SELECT s.login FROM sys_users s \
    JOIN domains d ON d.sys_user_id=s.id WHERE d.name='$D'")

  # Addon / parked domains (children)
  ADDONS=$(plesk db -Ne "SELECT name FROM domains \
    WHERE parentDomainId=(SELECT id FROM domains WHERE name='$D')")

  # PHP version
  PHP=$(plesk bin domain --info $D 2>/dev/null | awk -F': ' '/PHP version/ {print $2}' | tr -d ' ')

  # Mailboxes
  MAIL=$(plesk db -Ne "SELECT m.mail_name FROM mail m \
    JOIN domains d ON d.id=m.dom_id WHERE d.name='$D'")
  MAIL_COUNT=$(echo "$MAIL" | grep -c . || true)

  # Databases
  DBS=$(plesk db -Ne "SELECT db.name FROM data_bases db \
    JOIN domains d ON d.id=db.dom_id WHERE d.name='$D'")

  # Disk
  DISK_KB=$(du -sk /var/www/vhosts/$D 2>/dev/null | awk '{print $1}')

  cat >> "$OUT" <<JSON
{
  "primary_domain": "$D",
  "system_user": "$SYS_USER",
  "addon_domains": [$(echo "$ADDONS" | awk 'NF{printf "\"%s\",", $0}' | sed 's/,$//')],
  "php_version": "$PHP",
  "mailboxes": $MAIL_COUNT,
  "databases": [$(echo "$DBS" | awk 'NF{printf "\"%s\",", $0}' | sed 's/,$//')],
  "disk_kb": ${DISK_KB:-0}
}
JSON
done

echo ']}' >> "$OUT"
jq empty "$OUT" && echo "Wrote $OUT"

Run it:

chmod 700 /root/plesk-source-inventory.sh
/root/plesk-source-inventory.sh

Phase 1 — Build cpmove tarballs

The script below builds a cpmove-<user>.tar.gz for one Plesk subscription. Loop it over your inventory. The script does NOT touch the live Plesk environment — it dumps copies of everything to /root/cpmove-staging/.

#!/usr/bin/env bash
# /root/build-cpmove.sh
# Usage: /root/build-cpmove.sh <plesk-primary-domain> <target-cpanel-user>
set -euo pipefail

PRIMARY_DOMAIN="${1:?primary domain}"
CPUSER="${2:?cpanel user (8 chars max)}"
STAGE="/root/cpmove-staging/$CPUSER"

[[ "$(id -u)" -ne 0 ]] && { echo "Run as root."; exit 1; }
[[ ${#CPUSER} -gt 8 ]] && { echo "cPanel users are max 8 chars."; exit 1; }

PLESK_USER=$(plesk db -Ne "SELECT s.login FROM sys_users s \
  JOIN domains d ON d.sys_user_id=s.id WHERE d.name='$PRIMARY_DOMAIN'")
PLESK_HOME="/var/www/vhosts/$PRIMARY_DOMAIN"

[[ -d "$PLESK_HOME" ]] || { echo "Vhost not found: $PLESK_HOME"; exit 1; }

echo "==> Building cpmove for $PRIMARY_DOMAIN -> cPanel user $CPUSER"

# Build directory tree that mimics what /scripts/pkgacct produces
mkdir -p "$STAGE"/{homedir,mysql,mysql.sql,mail,dnszones,meta,logs,cp}

# === homedir ===
echo "==> Copying homedir"
rsync -a --exclude='logs/' --exclude='statistics/' --exclude='anon_ftp/' \
  "$PLESK_HOME/" "$STAGE/homedir/"

# Rename web roots: Plesk uses 'httpdocs', cPanel expects 'public_html'
if [[ -d "$STAGE/homedir/httpdocs" ]]; then
  mv "$STAGE/homedir/httpdocs" "$STAGE/homedir/public_html"
fi

# === MySQL ===
echo "==> Dumping databases"
DBS=$(plesk db -Ne "SELECT db.name FROM data_bases db \
  JOIN domains d ON d.id=db.dom_id WHERE d.name='$PRIMARY_DOMAIN'")
for DB in $DBS; do
  # cPanel expects <user>_<dbname> format. If Plesk already has owner prefix, keep it.
  NEW_NAME="${CPUSER}_${DB#*_}"
  echo "   Dumping $DB as $NEW_NAME"
  mysqldump --routines --triggers --single-transaction "$DB" \
    | sed "s/\`$DB\`/\`$NEW_NAME\`/g" \
    > "$STAGE/mysql.sql/$NEW_NAME.sql"

  # cPanel also wants a per-db record file
  cat > "$STAGE/mysql/$NEW_NAME.create" <<EOF
DROP DATABASE IF EXISTS \`$NEW_NAME\`;
CREATE DATABASE \`$NEW_NAME\` CHARACTER SET utf8mb4;
EOF
done

# === Mail ===
echo "==> Copying mail"
if [[ -d "$PLESK_HOME/mail" ]]; then
  # Plesk Dovecot mail layout is per-domain: /var/qmail/mailnames/<domain>/<user>/Maildir
  # cPanel layout is /home/<user>/mail/<domain>/<user>/{cur,new,tmp}
  for DOMDIR in /var/qmail/mailnames/$PRIMARY_DOMAIN /var/qmail/mailnames/$PRIMARY_DOMAIN/*; do
    [[ -d "$DOMDIR/Maildir" ]] || continue
    DOMAIN_NAME=$PRIMARY_DOMAIN
    LOCALPART=$(basename "$DOMDIR")
    TGT="$STAGE/homedir/mail/$DOMAIN_NAME/$LOCALPART"
    mkdir -p "$TGT"
    rsync -a "$DOMDIR/Maildir/" "$TGT/"
  done
fi

# === DNS zones ===
echo "==> Exporting DNS"
for D in $PRIMARY_DOMAIN $(plesk db -Ne "SELECT name FROM domains \
  WHERE parentDomainId=(SELECT id FROM domains WHERE name='$PRIMARY_DOMAIN')"); do
  plesk bin dns --info $D > "$STAGE/dnszones/$D.db" 2>/dev/null || true
done

# === Cron ===
echo "==> Exporting cron"
crontab -u "$PLESK_USER" -l 2>/dev/null > "$STAGE/cron/$CPUSER" || true

# === meta ===
echo "==> Building meta"
cat > "$STAGE/meta/cp_user" <<EOF
DNS=$PRIMARY_DOMAIN
DOMAIN=$PRIMARY_DOMAIN
HASCGI=1
IP=$(plesk bin ipmanage --list | awk 'NR==2{print $1}')
PARTITION=home
PLAN=default
RS=paper_lantern
USER=$CPUSER
EOF

# === Tar it up ===
cd /root/cpmove-staging
tar -czf "/root/cpmove-${CPUSER}.tar.gz" "$CPUSER/"
echo "==> Wrote /root/cpmove-${CPUSER}.tar.gz ($(du -sh /root/cpmove-${CPUSER}.tar.gz | awk '{print $1}'))"

# Clean stage
rm -rf "$STAGE"

Loop over the inventory:

chmod 700 /root/build-cpmove.sh
mkdir -p /root/cpmove-staging

# Generate user names — strip dashes, truncate to 8
jq -r '.subscriptions[] | "\(.primary_domain) \(.primary_domain | gsub("\\."; "") | .[:8])"' \
  /root/plesk-inventory-*.json > /root/cpmove-mapping.txt

while read DOMAIN USER; do
  /root/build-cpmove.sh "$DOMAIN" "$USER"
done < /root/cpmove-mapping.txt

Transfer the tarballs to the cPanel host:

scp /root/cpmove-*.tar.gz root@cpanel-target:/root/
scp /root/cpmove-mapping.txt root@cpanel-target:/root/

Phase 2 — Import on cPanel/WHM

On the cPanel/WHM target as root:

# Test-restore one account first
/scripts/restoreacct /root/cpmove-smallest.tar.gz

# If clean, batch restore
while read DOMAIN USER; do
  echo "==> Restoring $USER ($DOMAIN)"
  /scripts/restoreacct "/root/cpmove-${USER}.tar.gz" 2>&1 | tee "/root/restore-${USER}.log"
done < /root/cpmove-mapping.txt

/scripts/restoreacct runs many things in sequence: creates the user, sets quotas, untars the homedir, restores MySQL, recreates DNS, sets up Apache vhost. The log per account tells you which steps failed; the common failure is a database name that conflicts with one that already exists on the target (ERROR 1007: Can't create database). Resolve manually:

# Drop the conflicting db (CONFIRM it's not from another account)
mysql -e "DROP DATABASE wronguser_legacydata"
# Re-restore just the SQL portion
mysql wronguser_legacydata < /root/cpmove-staging/wronguser/mysql.sql/wronguser_legacydata.sql

After every restore, restart Apache and Dovecot once at the end:

/scripts/rebuildhttpdconf && /scripts/restartsrv_httpd
/scripts/restartsrv_dovecot
/scripts/restartsrv_exim

Phase 3 — Delta pass

The parts that don’t transfer cleanly through the cpmove path.

PHP version per domain. cPanel doesn’t read your Plesk PHP version. Set it explicitly:

jq -r '.subscriptions[] | "\(.primary_domain) \(.php_version)"' /root/plesk-inventory-*.json \
  | while read DOMAIN PHP; do
  # Strip "PHP " prefix if present, normalize "8.1.x" -> "ea-php81"
  V=$(echo $PHP | sed 's/PHP \?//' | awk -F. '{print "ea-php"$1$2}')
  echo "==> Setting $DOMAIN to $V"
  whmapi1 php_set_vhost_versions version=$V vhost-0=$DOMAIN
done

Mail account passwords. Plesk stores mailbox passwords in mail_names.password (sometimes encrypted, sometimes hashed). cPanel uses crypt-style hashes in /etc/<domain>/shadow. The dump above doesn’t carry passwords. Two options:

  • Force a password reset for every mailbox and notify users (cleanest, painful for 200 mailboxes).
  • Re-issue temporary passwords and email each user:
plesk db -Ne "SELECT d.name, m.mail_name FROM mail m \
  JOIN domains d ON d.id=m.dom_id" | while read DOMAIN MAILBOX; do
  TEMP_PW=$(openssl rand -base64 18 | tr -d /=+)
  uapi --user=$(whmapi1 listaccts search=$DOMAIN --output=json \
    | jq -r '.data.acct[0].user') Email passwd_pop \
    email=$MAILBOX@$DOMAIN password=$TEMP_PW
  echo "$MAILBOX@$DOMAIN: $TEMP_PW" >> /root/mail-resets.csv
done

Then encrypt the CSV with gpg --symmetric, and have the account manager arrange password rotation with the customers. Do not email passwords in cleartext.

SSL. Run AutoSSL once DNS resolves to cPanel:

whmapi1 start_autossl_check
# Or per-user:
whmapi1 start_autossl_check_for_one_user username=user1

Cron jobs. The cron file copied in the cpmove archive lands at /var/spool/cron/$CPUSER. Verify:

for U in $(awk '{print $2}' /root/cpmove-mapping.txt); do
  echo "=== $U ==="
  crontab -u $U -l 2>/dev/null
done

Rewrite Plesk-specific paths (/var/www/vhosts/<domain>/) to cPanel paths (/home/<user>/public_html/).

Phase 4 — DNS cutover

Same DNS pattern as the cPanel-to-Plesk runbook in reverse: lower TTLs, validate via host-file overrides, cut DNS, watch mail for the TTL window, leave Plesk hot for 7 days as fallback. Issue Let’s Encrypt or AutoSSL only after DNS resolves to cPanel.

Watch logs on both sides during cutover:

# cPanel
tail -f /var/log/exim_mainlog | grep -E '<=|=>'
tail -f /usr/local/apache/logs/error_log

# Plesk (still running)
tail -f /usr/local/psa/var/log/maillog
tail -f /var/log/plesk/access_log

Decommissioning Plesk

After 7 days of clean cutover, stop Plesk services but keep the data:

plesk bin server_pref --set-maintenance-mode true
systemctl stop psa
systemctl disable psa
# Don't `rm -rf /var/www/vhosts` — keep the data as cold storage for 90 days

If the Plesk host is also being decommissioned hardware-wise, take a final filesystem snapshot before tearing it down.

Rollback

Pre-cutover: trivial. Post-cutover: same constraint as the forward migration — new data on cPanel that doesn’t exist on Plesk has to be reverse-migrated, which is its own runbook. Set a one-hour go/no-go.


Stack Harbor builds and runs both directions of control-panel migration under our migration solutions practice. We can run this in parallel with the existing fleet so the cutover is the only customer-facing moment — start a conversation to scope the move.