cPanel Account Isolation on AlmaLinux 9 for Agencies

What you are building
This tutorial shows you how to set up cPanel account isolation on a fresh AlmaLinux 9 server for agency and reseller workflows. The goal is practical: reduce cross-account risk, keep one noisy or compromised site from touching the rest, and give your team a cleaner handoff path when clients change tiers or move between management plans. If you are deploying on Hostperl, a VPS or dedicated server from Hostperl VPS hosting is a sensible fit for this use case, because you get full control over SSH, firewall policy, and systemd services.
You will start with the first SSH login, confirm the operating system, set up non-root administration, install cPanel, tighten SSH, choose isolation controls for each account, and verify the result. For related background, Hostperl also has a guide on SSH hardening after migration and a separate workflow for agency hosting migrations that helps you plan client moves without support gaps.
Before you start
Supported platform for this tutorial: AlmaLinux 9 only. cPanel support is tied to Enterprise Linux-compatible systems, and AlmaLinux 9 is the least-surprising choice for a fresh agency server in 2026. The steps below stay on that track because cPanel, firewalld, SELinux, and the package layout all behave differently from Debian-family systems.
You will need:
- A fresh AlmaLinux 9 server with root SSH access.
- A DNS hostname already pointed at the server, such as
server.example.com. - A valid cPanel license.
- Enough disk space for cPanel, logs, and client data.
- Console access through your provider in case you lock down SSH too early.
Keep your original root session open until the new admin login is tested. That sequencing matters. If you change SSH policy before confirming the replacement account, you can lock yourself out of the only working path back in.
1) Connect to the server and confirm the operating system
On your local computer, open the first SSH session as root:
ssh root@203.0.113.10203.0.113.10 is a documentation example. Replace it with the public IP assigned to your server.
After you log in, detect the OS version before you do anything else:
cat /etc/os-releaseYou should see AlmaLinux and version 9.x in the output. If you do not, stop here and use a matching tutorial for that platform instead of forcing these commands onto another distribution.
2) Update the server and install the base tools
On the VPS as root, refresh package metadata and install the tools you will need for the rest of the setup:
dnf -y updatednf -y install curl wget vim firewalld policycoreutils-python-utils perl tar rsync chronyThe update step gets you current security fixes. The tool set gives you a working editor, firewall control, SELinux tools, transfer utilities, and time sync.
Check that time sync is active. cPanel and mail systems behave better when the clock is right:
systemctl enable --now chronydchronyc trackingYou should see a valid reference source and a small offset, not repeated “unsynchronised” status.
3) Set the hostname and prepare name resolution
cPanel expects a real fully qualified domain name. Set the hostname to match the server’s public identity:
hostnamectl set-hostname server.example.comReplace server.example.com with the hostname you control in DNS. Then confirm it is persistent:
hostnamectl statusIf your DNS A record already points to the server, a simple local hosts entry can help installation and mail services resolve the hostname while DNS propagates:
echo "203.0.113.10 server.example.com server" >> /etc/hostsThis line uses the documentation IP again. Replace it with your actual server address.
4) Create a non-root admin account and test sudo
Even though cPanel often begins life as root-managed infrastructure, you should still create a named administrator for day-to-day work. That makes support handoffs cleaner and helps reduce accidental changes in production.
On the VPS as root, create the account, add it to the wheel group, and set a password:
useradd -m -G wheel deploypasswd deployNow open a second terminal on your local computer and test the account without closing the root session:
ssh deploy@203.0.113.10After login, confirm sudo works:
sudo -vIf sudo prompts for the password and accepts it, the account is ready. If you use SSH keys, copy your public key now:
ssh-copy-id deploy@203.0.113.10Then tighten the account’s permissions on the server:
sudo -iu deploy mkdir -p ~/.sshsudo -iu deploy chmod 700 ~/.sshsudo -iu deploy touch ~/.ssh/authorized_keyssudo -iu deploy chmod 600 ~/.ssh/authorized_keysIf you manage the key by hand, paste it into /home/deploy/.ssh/authorized_keys and keep the ownership on the deploy user. Do not disable root SSH yet. Wait until you can log in with the non-root account from a new terminal.
5) Open the firewall before installing cPanel
cPanel uses several ports. You do not want to cut off WHM, mail, or HTTP access after the installer finishes. Start firewalld now and allow the common services first.
On the VPS as root, enable the firewall service:
systemctl enable --now firewalldThen add the core services needed for initial access and web management:
firewall-cmd --permanent --add-service=sshfirewall-cmd --permanent --add-service=httpfirewall-cmd --permanent --add-service=httpsfirewall-cmd --reloadCheck the active rules:
firewall-cmd --list-allYou should see SSH, HTTP, and HTTPS listed. Later, cPanel will add its own requirements, but this is the safe minimum to avoid early lockout.
6) Install cPanel the supported way
cPanel installation is not a generic package install. Use the official installer from the server as root. Before you run it, make sure the hostname is correct and the server is fully updated, because post-install cleanup is harder on a half-configured box.
On the VPS as root, download and launch the installer:
cd /homecurl -o latest -L https://securedownloads.cpanel.net/latestsh latestThe installer can take a long time. That is normal. Do not interrupt it unless the process clearly fails. When it finishes, it usually writes status output to the terminal and logs under /var/log/cpanel-install.log.
Confirm the main services are present:
systemctl status cpanel.serviceYou should see active services rather than failed units. If the installer stops with dependency errors, check network access first and then inspect the install log:
tail -n 50 /var/log/cpanel-install.log7) Lock down SSH before you expose WHM broadly
Once cPanel is installed, tighten SSH access so routine administration uses the named account instead of direct root login. This step is exactly the kind of housekeeping that prevents support incidents later.
On the VPS as root, edit the SSH daemon configuration:
vi /etc/ssh/sshd_configAdd or update these lines:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploySave and exit vi with :wq. Then test syntax before reloading:
sshd -tIf the command returns no output, the syntax is valid. Reload SSH safely:
systemctl reload sshdNow test a fresh SSH session from your local computer. The deploy account should still work, and root should no longer be accepted. Keep the original root shell open until you confirm the new login succeeds.
8) Set up cPanel account isolation for agency workloads
For cPanel-based agency hosting, isolation is less about a single switch and more about a layered setup. The key pieces are per-account permissions, jailed or restricted shell behavior where appropriate, and avoiding cross-account write access through loose ownership.
Start by confirming each account uses its own home directory and that file ownership is correct. A quick example for one hosting account named client1 looks like this:
ls -ld /home/client1find /home/client1/public_html -maxdepth 2 -type f -printf '%u:%g %p
' | headYou want the owner to match the site account, not root or a shared service user. If you need to correct ownership on a site tree, do it carefully and only for the intended account:
chown -R client1:client1 /home/client1/public_htmlIf your workflow uses jailed shell or restricted access through cPanel account settings, enable it per account inside WHM after the installer is stable. The exact UI path can vary by license tier, but the principle is consistent: limit shell reach, keep separate ownership, and avoid shared writable directories across client accounts.
For additional context on reducing account spillover after service moves, the Hostperl article on SSH hardening after migration pairs well with this section.
9) Check SELinux instead of disabling it
AlmaLinux ships with SELinux enabled. That is useful on a multi-account hosting server. The wrong move is to disable it because a permission problem looks inconvenient. The better move is to identify the denial and fix the policy or context.
On the VPS as root, check the current mode:
getenforceYou should see Enforcing. If an app or account migration fails, look for denials first:
ausearch -m avc -ts recentTo relabel a client tree after a move, use the proper file context tool rather than a blanket disable:
restorecon -Rv /home/client1That is the safer path for production. If a custom port or service needs policy work, handle it with explicit SELinux tools rather than turning protection off globally.
10) Verify the web stack and account access
Once the server is ready, confirm the primary management endpoints are listening. This helps separate cPanel installation issues from firewall or DNS problems.
On the VPS as root, check the active listeners:
ss -tulpn | egrep ':(22|80|443|2082|2083|2086|2087)\s'You should see SSH, HTTP, HTTPS, and WHM/cPanel ports bound. If any are missing, inspect the relevant service rather than guessing.
Check the HTTP response locally:
curl -I http://127.0.0.1A healthy server should return a valid HTTP status, not connection refusal. For WHM, open a browser from your local computer and test:
https://203.0.113.10:2087Replace the documentation IP with your server address. If you use a hostname with proper DNS and certificate trust, that is even better for long-term operations.
11) Troubleshoot the failures you are most likely to see
Most first-run problems fall into a small set of categories. Use the commands below before you chase symptoms elsewhere.
Installer stalled or failed:
tail -n 100 /var/log/cpanel-install.logLook for package fetch errors, DNS resolution issues, or missing Perl modules. Fix the network path first if downloads are failing.
SSH rejects the deploy user:
ls -ld /home/deploy /home/deploy/.ssh /home/deploy/.ssh/authorized_keysExpected clues are ownership by deploy and strict permissions. If they are wrong, correct them:
chown -R deploy:deploy /home/deploy/.sshchmod 700 /home/deploy/.sshchmod 600 /home/deploy/.ssh/authorized_keysSELinux denial after a migration:
ausearch -m avc -ts recentIf you see denials against a moved site tree, relabel it instead of disabling enforcement:
restorecon -Rv /home/client1Firewall blocks WHM or mail services:
firewall-cmd --list-allIf a needed port is absent, add it permanently, then reload. For example, to allow the WHM port explicitly:
firewall-cmd --permanent --add-port=2087/tcpfirewall-cmd --reload12) Reboot test and rollback path
A production tutorial is not complete until you know the server comes back cleanly. Reboot only after the account, firewall, and SSH changes are verified.
On the VPS as root, test boot persistence:
systemctl is-enabled firewalld chronyd sshd cpanelThen reboot:
rebootAfter the server returns, reconnect and check the same services again:
ssh deploy@203.0.113.10systemctl --no-pager --full status firewalld chronyd sshd cpanelIf something breaks, your rollback is straightforward: use provider console access, revert the SSH hardening change if needed, and inspect /etc/ssh/sshd_config, firewall rules, and cPanel logs before making another change. That is safer than guessing under pressure.
13) Final smoke test for agency operations
For a real-world smoke test, confirm that you can log in, reach WHM, and manage a sample account without crossing ownership boundaries. On the server, validate the account tree and one web document root:
namei -l /home/client1/public_htmlFrom your local computer, open WHM and verify that the dashboard loads over HTTPS. Then open one client site and one administrative path such as a file manager or account settings screen. If all three work, the server is ready for client onboarding.
If you are building an agency-ready stack on Hostperl, this is a good point to review a matching server plan on dedicated server hosting if you expect heavier client counts, or stay on Hostperl VPS hosting for smaller account portfolios.
If you want a clean launch path for client hosting, Hostperl can help you choose the right server class and support model before you move production accounts. For lighter agency setups, a Hostperl VPS is usually enough; for higher-density client workloads, dedicated server hosting gives you more isolation headroom and room for growth.
That matches the realities of agency hosting: separate accounts, predictable access, and fewer surprises during migrations or support handoffs.
FAQ
Should I disable root SSH immediately after cPanel installs?
No. First verify that the deploy user can log in, use sudo, and reach the server after a reboot. Only then remove root SSH access.
Does cPanel account isolation replace good file ownership?
No. Isolation helps, but correct ownership, restrictive permissions, and SELinux-friendly workflows still matter.
Why use AlmaLinux 9 for this tutorial?
Because it matches cPanel’s supported enterprise Linux track and gives you predictable firewalld and SELinux behavior for production work.
What if WHM does not open after installation?
Check firewall-cmd --list-all, confirm the cPanel services are active, and inspect the install log before changing other settings.
Can I reuse these steps on Debian or Ubuntu?
No. cPanel is not a Debian-family tutorial in this form, and the firewall, SELinux, and package assumptions here are AlmaLinux 9 specific.
