Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is an option in whm/cpanel to enable jailshell access for any hosting account.

I want to know if it is possible to enable that option for any or all cpanel hosting accounts through command line.

share|improve this question

closed as off-topic by masegaloeh, Andrew Schulman, fuero, Hyppy, Jenny D Apr 28 '15 at 14:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

Jailshell can be enabled for a user in WHM by navigating to Manage Shell Access under Account Functions.

To setup jailshell access for a user from the command line interface, simply use the operating system's change shell command as root, for example:

# chsh -s /usr/local/cpanel/bin/jailshell ${username}

You may also be interested in these sections of cPanel's documentation:


${username} and $username both refer to a local variable called username.

Suppose your username is fahad.

If you want to change the shell without using the variable, it would look like this:

# chsh -s /usr/local/cpanel/bin/jailshell fahad

If you typed chsh -s /usr/local/cpanel/bin/jailshell ${username} without setting the variable username first, it would be equivalent to ch -s /usr/local/cpanel/bin/jailshell without any parameter after to designate the user whose shell you want to change, and then the command defaults to changing the shell for the currently logged in user.

You also said that you're getting this error:

 '0' is not a valid user id, and may not run jailshell (cpanel users file missing).

That is caused because the root account has been set to use jailshell, though it should not be. This could have happened when you executed the above command without passing the parameter for the user account (i.e. by using an unset variable).

You may wish to reset your shell to /bin/bash in WHM by navigating to Manage Shell Access under Account Functions. Alternatively, if you are comfortable doing so, you can edit the change is in the /etc/password file manually by running vipw (as the file cannot be edited directly easily under most systems).

share|improve this answer
I have tried from root user chsh -s /usr/local/cpanel/bin/jailshell ${username} replaced {username} to {my cpanel user name} but it changed my root to jail shell. Now when I login by root id it gives me this error '0' is not a valid user id, and may not run jailshell (cpanel users file missing). and also I am getting this prompt -jailshell-4.1# – Fahad Apr 18 '14 at 18:38
I updated my answer. Hope that helps. – Guy Hughes Apr 18 '14 at 18:48
I have created a ticket on my hosting support regarding this issue but they are saying ""This broke root. Using this command improperly from the command line has caused root to be put into a jailed shell. The only way to restore this is to do a vps restore."" Is there any way we can restore root user shell access to normal without restoring the VPS ?? – Fahad Apr 18 '14 at 20:38
If your VPS provider supports it, you may be able to reboot the VPS into single user mode or using a recovery kernel. – Guy Hughes Apr 18 '14 at 20:49
Someone in your position was able to recover via SU mode. – Guy Hughes Apr 18 '14 at 20:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.