The copy_user_mail_as_root Script

Valid for versions 96 through the latest version



Last modified: March 19, 2021


The /usr/local/cpanel/scripts/copy_user_mail_as_root script copies a cPanel account’s mail to or from a remote server as the root user. After you run the script, it will prompt for a root API token on the remote server.

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/scripts/copy_user_mail_as_root [options]


Use the following options with this script:

Option Description Example
--mode Required
Whether to copy the account’s mail to the local server or a remote server:
  • tolocal — Download mail from a remote server to the local server.
  • toremote — Upload mail from the local server to a remote server.
hostname Required
The hostname to copy the account’s mail to or from.
username Required
The cPanel account’s username.
--help Display the script’s help documentation --help


The following example uploads the exampleuser account’s mail to the remote server:

/usr/local/cpanel/scripts/copy_user_mail_as_root --mode=toremote exampleuser

Additional Documentation