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.

Grant SSH to subdomain via key?

Discussion in 'Security' started by Harikalar Kutusu, Nov 26, 2016.

Tags:
  1. Harikalar Kutusu

    Joined:
    Jan 13, 2016
    Messages:
    23
    Likes Received:
    6
    Trophy Points:
    3
    Location:
    Istanbul, Turkey
    cPanel Access Level:
    Root Administrator
    Hi,

    I have a VDS with root access. I don't have any account with shell access, except the main domain example.com, which is jailed. I have a key "mainkey" for it and can access via the accounts name "example".

    I want to have a subdomain sub.example.com and allow special ssh access to only that part (subdomain) via ssh having a key "subkey" and possibly a separate login "sublogin" for that purpose. And also the "mainkey" with main account should be able to access it.

    All I want to do is to enable some automated devices to reach that part of the server periodically and securely (for the server and for the connection)...

    What is the best way to accomplish this?

    Thank you...
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,405
    Likes Received:
    53
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Conceptually speaking, SSH can be enabled for user. You cannot get a separate SSH for a subdomain but only for main user and you can access all in this account through it..

    However, if there is any specific requirement, the work around for this would to create a separate cPanel account for this subdomain..
     
    Harikalar Kutusu likes this.
  3. Harikalar Kutusu

    Joined:
    Jan 13, 2016
    Messages:
    23
    Likes Received:
    6
    Trophy Points:
    3
    Location:
    Istanbul, Turkey
    cPanel Access Level:
    Root Administrator
    I'm not sure if I can create an account without a new domain name... Perhaps you are referring to scripts that I don't know anything about :/ Or playing with configuration files?

    What about creating a user in bash, giving rights to those directories and using ssh-keygen etc? Is it possible this way?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,173
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I recommend creating a separate cPanel account for the subdomain for this purpose. Otherwise, you'd have to setup a manual workaround like the one described at:

    restrict access based on SSH key

    Thank you.
     
    Harikalar Kutusu likes this.
  5. Harikalar Kutusu

    Joined:
    Jan 13, 2016
    Messages:
    23
    Likes Received:
    6
    Trophy Points:
    3
    Location:
    Istanbul, Turkey
    cPanel Access Level:
    Root Administrator
    OK, thank you...

    I found out that I could create an account for a subdomain in WHM, I didn't know that...
     
    cPanelMichael likes this.
  6. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,405
    Likes Received:
    53
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Glad you figure it out. Yes, you can create legitimate domain name that is fully qualified, even if it is a subdomain because subdomain is also a fully qualified domain and that is what I was referring too.
     
Loading...

Share This Page