The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

jailed SSH with API

Discussion in 'cPanel Developers' started by Monotoko, Mar 20, 2011.

  1. Monotoko

    Monotoko Member

    Joined:
    Mar 1, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hi All,

    I have a system which allows extras such as a dedicated IP and SSH access for an extra fee. However when using the createacct API call, hasshell can only be set to 1 or 0. 1 being full SSH and 0 being none.

    How can I set it up in order to allow the user jailed SSH access if they choose the option to have SSH?

    Daniel
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Daniel,

    I do not personally know how to enable jailed shell during account creation in the API, but you can enable jailed shell with this command:

    Code:
    chsh -s /usr/local/cpanel/bin/jailshell username
    You might add that to your script after account creation to switch to allow jailed shell for the created user as one idea.

    If there is a possibility in the API, which I wasn't able to find either, then one of our developers who handle the API will likely provide details on what else might be used.

    Thanks!
     
  3. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This cannot be set at the same time as HASSHELL, but the modifyacct xml-api call has a parameter called "shell"

    This allows you to set the shell you wish to use (jailshell/bash/noshell) so that you can set the shell for a user.

    valid values are:

    jailshell
    noshell
    bash


    Undocumented feature, and I'm not sure why it's not documented at this time, but I'll be sending it over for testing and documentation later.
     
  4. Monotoko

    Monotoko Member

    Joined:
    Mar 1, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Thank you so much to both of you. I found a way to around the issue by using the "Tweak Settings" option in WHM and making each new user automatically have a jailed shell.

    I have now implimented Matt's API call and modify the user after I have created the account.

    Daniel
     
Loading...

Share This Page