Terminate a cpanel account from the server using command or in command line is easy task. We can also terminate cpanel user account in WHM. In WHM after logged in you need to select the cPanel account and click on the terminate option to get the job done. We will be covering the detailed article on How to terminate the cPanel account in command line.
This article provides the steps needed to terminate a cPanel account from the command line using the removeacct script.
Procedure to terminate a cPanel account
1.Access the server’s command line as the ‘root’ user via SSH or “Terminal” in WHM.
2.Run the following command.
/scripts/removeacct $cpusername
Please note that “$cpusername” must be replaced by the username of the account to remove.
3.Confirm that you want to remove the account by typing y.
Are you sure you want to remove the account “$cpusername”, and DNS zone files for the user? [y/N]? y
If in case you can’t able to remove the account get error Cannot remove account with error – You do not have a user named “user”
Than follow the below steps to replicate and resolve the issue.
The cPanel account’s userdata folder needs to be created, and the group needs to be set. In the following steps, replace “$username” with the username you’re trying to remove.
1.Create the userdata directory:
mkdir /var/cpanel/userdata/$username
2.Change the group of the directory to match the user:
chgrp $username /var/cpanel/userdata/$username
3.Set the proper permissions for the directory:
chmod 750 /var/cpanel/userdata/$username
After done all the above do the the same steps mentioned above. Now the cpanel user account terminated in the server.
If you have struck in enabling email forwarding to know how to do this in cPanel click here.