Skip to content

Fixing a cPanel account that lost shell (SSH) access

A cPanel account can lose SSH access after a transfer, a security policy change, or a Jailshell escape attempt. Here is how to restore it cleanly without weakening the box.

A developer who could SSH in yesterday gets Permission denied (publickey) today, or lands in a Jailshell where their deploy script fails because half the binaries are missing, or simply gets a This account is currently not available banner. Nothing about the credentials changed. Something in the account’s shell configuration did.

What’s happening

cPanel manages shell access through /etc/passwd and a small set of side files. The user’s shell can be /bin/bash (normal shell), /usr/local/cpanel/bin/jailshell (chroot jail), or /usr/local/cpanel/bin/noshell (no SSH). A WHM account transfer often resets shell to noshell for safety. A failed login from a flagged IP can trigger cPHulk to lock the account at the PAM level. AutoSSL renewals do not touch shell, but a global SSH policy update — AllowGroups, DenyUsers, or a per-domain Match User — can quietly exclude the cPanel user from sshd.

How to verify

getent passwd USER
chsh -l 2>/dev/null  # not present on cPanel; check /etc/shells
grep "^USER:" /etc/passwd
whmapi1 listaccts search=USER searchtype=user | grep -i shell

Check cPHulk first — it is the most common silent blocker:

whmapi1 list_brutes
whmapi1 flush_cphulk_login_history

Then look at the sshd side:

sshd -T -C user=USER 2>&1 | grep -iE "allowusers|allowgroups|denyusers|match"
tail -50 /var/log/secure | grep USER

If sshd -T shows the user falling into a Match block that sets PasswordAuthentication no and no key is present, the account effectively has no shell even though /etc/passwd looks fine.

The fix

  1. Set shell in WHM under “Manage Shell Access” — choose jailshell for developer accounts unless there is a documented reason for full shell. Avoid /bin/bash for shared-hosting tenants.
  2. Verify the user is in the wheel-equivalent group only if your sshd config requires it. cPanel’s default does not, but custom hardening often adds an AllowGroups directive that excludes new cPanel users.
  3. Re-deploy the SSH key via cPanel’s “SSH Access” interface or uapi --user=USER SSH import_key key=.... Permissions on ~/.ssh must be 700 and ~/.ssh/authorized_keys must be 600 — anything else and sshd silently refuses the key. Run /scripts/fixhome USER to repair permissions in one pass.
  4. If cPHulk is the cause, whitelist the developer’s source IP under “cPHulk Brute Force Protection” → “Whitelist” before flushing the lockout — otherwise it will lock again on the next attempt.
  5. For Jailshell missing tools, do not symlink binaries into the jail. Use /var/cpanel/jailshell-extra-binaries (one binary path per line) and re-run /scripts/update_jailshell_mountpoints.

Jailshell is the correct default for tenant accounts. Reach for full shell only when the workload truly needs it.

If shell access is being lost repeatedly after policy changes, the access model is what needs review — covered under Deployment Management. Open a ticket to walk through it.