How to Suspend a cPanel Account via SSH
As a hosting company, Linkysoft "لينكي سوفت" offers website hosting and private servers. One of the key tasks for administrators is suspending a cPanel account via SSH. This tutorial will guide you step-by-step on how to do this across various supported OS platforms, such as AlmaLinux, CentOS, CloudLinux, and Ubuntu.
Step 1: Access the Server via SSH
First, you need to log in to your server via SSH. If you’re using Windows, you can use PuTTY, and for macOS/Linux, you can use the Terminal application.
ssh root@your-server-ip
Enter your root password when prompted to gain access to the server.
Step 2: Find the Username of the cPanel Account
If you do not know the username of the account to be suspended, you can use the following command to search for the domain’s associated username:
grep domainname.com /etc/trueuserdomains
Replace domainname.com with the actual domain. This command will return the cPanel username associated with the domain.
Step 3: Suspend the Account
Once you have the username, you can suspend the account by using this command:
/scripts/suspendacct username
Replace username with the actual cPanel username. This will immediately suspend the account, disabling access to both cPanel and the website.
Step 4: Verify the Suspension
Check Account Status
To verify that the account has been successfully suspended, use the following command:
/scripts/listaccts | grep username
Look for the account status in the output. If the account has been suspended, you will see it listed as "Suspended".
Test Account Access
Try to log in to the suspended cPanel account via your browser. The login should fail, confirming that the suspension is active.
Supported Operating Systems
These steps apply to the following Linux distributions commonly used in hosting environments:
- CentOS
- AlmaLinux
- CloudLinux
- Ubuntu (for experimental use)
Troubleshooting Common Issues
Invalid Username
If you receive an error that says "Invalid user", ensure you have typed the correct username. You can use this command to confirm the username:
grep domainname.com /etc/trueuserdomains
Account Not Suspending
If the account is not suspending properly, make sure you have root access and that the username exists on the server. You can check the list of accounts with the following command:
/scripts/listaccts
Unsuspending an Account
If you need to unsuspend an account, you can do so by using this command:
/scripts/unsuspendacct username
Conclusion
Suspending a cPanel account via SSH is an essential task for maintaining control over your server. By following the steps outlined in this tutorial, you can quickly suspend any problematic accounts and ensure your server remains in optimal condition. At Linkysoft "لينكي سوفت", we strive to provide efficient and secure hosting solutions to our clients.