Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Enabling SSH for cPanel Account Not Working

Discussion in 'General Discussion' started by the_Dsigner, Jun 6, 2018.

Tags:
  1. the_Dsigner

    the_Dsigner Well-Known Member

    Joined:
    Jan 2, 2014
    Messages:
    48
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Montreal, Canada
    cPanel Access Level:
    Website Owner
    I have a dedicated server running CentOS 6.9 with WHM 70.0.48.

    So I have tried to get the SSH to work awhile ago for one of my Cpanel accounts with no luck and gave up. I once gain tried this afternoon and again after many hours the same result..."Server has refused your key".

    I"m not sure what i'm doing wrong. I have read the WHM faq section, blog posts, and yt how-to vids. I have gone into my WHM and verified SSH is turned on under accounts, and set to normal SSH.

    I create a new public/private key in the Cpanel account in question. Key has been authorized, I convert the public key to ppk format for use in putty, download key. In putty I load the key in the SSH/Auth section. I have tried a combination of using the:

    1. Server IP that I use for SSH root to the WHM (which works fine) then logging in under the cpanel username. Not accepted.
    2. Cpanel domain with the auto-login in the Connection/Data tab of putty as the account username. Not accepted.
    3. Tried creating a key with PuttyGen then importing into Cpanel SSH. Not accepted.
    I can SSH with putty into the WHM as root, but for an individual Cpanel account I can't get it working. What am I doing wrong here?

    Thanks
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,367
    Likes Received:
    1,855
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @the_Dsigner,

    Can you monitor the /var/log/secure log file when you attempt to login as the individual user via SSH and let us know the output? EX:

    Code:
    tail -f /var/log/secure
    Ensure to replace any identifying information with examples.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. the_Dsigner

    the_Dsigner Well-Known Member

    Joined:
    Jan 2, 2014
    Messages:
    48
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Montreal, Canada
    cPanel Access Level:
    Website Owner
    ok took a look in the log and found this after doing another attempt...

    Jun 7 14:54:51 ADMIN01 sshd[14301]: User USER01 from 196.000.00.00 not allowed because not listed in AllowUsers
    Jun 7 14:54:51 ADMIN01 sshd[14302]: input_userauth_request: invalid user USER01
     
  4. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    718
    Likes Received:
    122
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    Seems like you are using

    AllowUsers in ssh

    Code:
    grep -i AllowUsers /etc/ssh/sshd_config
    You will want to add that range like so

    Code:
    *@196.0.0.0/8
    just add it to the end of the

    AllowUsers line separating it from the previous CIDR with a space.

    Also.. *@196.0.0.0/8 allows that entire range, so you may want to specify a smaller range or just define the actual IP address.

    Once done restart ssh:

    Code:
    /scripts/restartsrv_sshd
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    the_Dsigner and cPanelMichael like this.
  5. the_Dsigner

    the_Dsigner Well-Known Member

    Joined:
    Jan 2, 2014
    Messages:
    48
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Montreal, Canada
    cPanel Access Level:
    Website Owner
    I'm not familiar with the AllowUsers list. Is this something that's setup by default in the SSH?
     
  6. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    718
    Likes Received:
    122
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    Nope, that is not a default option, its not even mentioned in the config by default.

    If you don't need/want it, just comment it out but comment out similar lines as well like

    DenyUsers, AllowUsers, DenyGroups, AllowGroups
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    the_Dsigner likes this.
  7. the_Dsigner

    the_Dsigner Well-Known Member

    Joined:
    Jan 2, 2014
    Messages:
    48
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Montreal, Canada
    cPanel Access Level:
    Website Owner
    Thanks. I don't know why that was activated as I don't want to add/remove Cpanel users every time I feel the need to SSH into that account.
     
  8. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    718
    Likes Received:
    122
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    Yeah would be a pain for sure.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. the_Dsigner

    the_Dsigner Well-Known Member

    Joined:
    Jan 2, 2014
    Messages:
    48
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Montreal, Canada
    cPanel Access Level:
    Website Owner
    Just took a look in my CentOS directory and there is only the ssh_config file, no sshd_config file in /ect/ssh/
     
  10. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    718
    Likes Received:
    122
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    What does this give you:

    Code:
    grep -rli AllowUsers /etc/ssh/
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,367
    Likes Received:
    1,855
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @the_Dsigner,

    The /etc/sshd_config file should exist. Are you logged in via SSH as root when browsing to the /etc/ directory?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice