Change Domain Name for cPanel Account from SSH Terminal

This article provides a quick solution for changing the domain name of a cPanel account. Root level access is required.

In the case that the cPanel account domain name should be quickly modified (such as raddomain.net -> raddomain.com), the following procedure can solve the issue.

Prerequisites

  • Requires full root access
  • cPanel installed on server
  • Recent backup of account which is to be modified

Procedure

As root user, access the server via SSH and run the following commands:

/scripts/removeacct --force username
/scripts/restorepkg --force --ip=xxx.xxx.xxx.xxx /home/backupuser/backup/cpmove-username.tar.gz
mv /var/cpanel/userdata/username/username.com /var/cpanel/userdata/username/username.net
mv /var/cpanel/userdata/username/username.com.cache /var/cpanel/userdata/username/username.net.cache
sed -i -e 's/username\.com/username\.net/g' /var/cpanel/userdata/username/username.net
rm -f /var/cpanel/userdata/username/cache
sed -i -e 's/username\.com/username\.net/g' /var/cpanel/userdata/username/main
rm -f /var/cpanel/userdata/username/main.cache
sed -i -e 's/username\.com/username\.net/g' /var/cpanel/users/username
mv /var/named/username.com.db /var/named/username.net.db
sed -i -e 's/username\.com/username\.net/g' /var/named/username.net.db
sed -i -e 's/username\.com/username\.net/g' /etc/named.conf
/scripts/updateuserdomains
/scripts/updateuserdatacache --force username
/scripts/rebuildhttpdconf
/scripts/restartsrv_apache
rndc reload
#Changing Password
export ALLOW_PASSWORD_CHANGE=1
/scripts/chpass username myhardpassword
#Synching FTP pass
/scripts/ftpupdate
  • Substitute the cPanel account username for "username"

  • Substitute existing domain name for "username.net"

  • Substitute the new domain name for "username.com"

Was this answer helpful?

 Print this Article

Also Read

Install WGET on CentOS VPS or Dedicated Server

This article describes the process of installing wget on a new installation of CentOS Installing...

Install WGET on CentOS VPS or Dedicated Server

This article describes the process of installing wget on a new installation of CentOS Installing...

Removing cPanel Accounts with /scripts/removeacct Script

The /usr/local/cpanel/scripts/removeacct script terminates cPanel accounts from the command line....

Removing cPanel Accounts with /scripts/removeacct Script

The /usr/local/cpanel/scripts/removeacct script terminates cPanel accounts from the command line....

How to Install and Run MTR Report

In this article, we will demonstrate how to install MTR on a CentOS server. MTR is a powerful...