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.

Create SSH Keys and login using putty - access denied

Discussion in 'General Discussion' started by isputra, Apr 5, 2008.

  1. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
  2. RSCChris

    RSCChris Active Member

    Joined:
    Sep 15, 2004
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Whenever I use keys I just use the PuttyGEN program to make the key and then I upload it to the server. Do you load the key when you try to login via putty? If you don't tell the client to load the key, then it won't send it to the server and you won't be able to log in.
     
  3. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
    I'm root.

    I also try to use Puttygen and upload the key. But the result is the same.

    When i try to restart sshd through WHM, it's failed on message but i still can access it so it's not fail.

    Something wrong here but i can't figure it out.
     
  4. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    I've never used the cpanel / whm interface to setup keys but its very simple to do manually. Perhaps you just need a sshd_config adjustment.


    1. First copy your public key to your clipboard.
    2. Add your key to /root/.ssh/authorized_keys (create the directory and file if it doesn't exist, one key per line.)
    3. chmod authorized_keys to 0600
    4. Edit /etc/ssh/sshd_config uncomment the following lines:

    PubkeyAuthentication yes
    AuthorizedKeysFile .ssh/authorized_keys

    5. Restart sshd

    Thats pretty much it. Once you verify your key works, then modify sshd_config again and comment out password authentication if desired.
     
  5. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
    Hi,
    still not works.

    -------------------------
    login as: root
    Authenticating with public key "rsa-key-root"
    Passphrase for key "rsa-key-root":
    Access denied
    root@xx.xx.xx.xx's password:
    --------------------------

    Could you give me the inside of your sshd_config file ? I think something messy on my part that affecting my ssh login.
     
    #5 isputra, Apr 11, 2008
    Last edited: Apr 11, 2008
  6. nyjimbo

    nyjimbo Well-Known Member

    Joined:
    Jan 25, 2003
    Messages:
    1,125
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    New York
    Do you have the whole suite of programs from the Putty group. If so then start "PAgeant", which is the putty key auth agent. When you see it in your toolbar like your other running programs (usually near the time) right click on it and go to VIEW KEYS, the big white box will probably be empty, next click on ADD KEY, it should then bring up a file finder for you to locate the key on your local PC. Find the *.ppk file and open/add it. If it has a pass-phrase it will ask you for it, if you get it right it will add it to the keys listed. You can then try to logon to your system again with this Agent running, but you dont have to.

    The reason to do the above is to make sure the key is properly formatted on your pc and that your password really does match what you think it is. Give it a try and let us know if that part works.
     
  7. isputra

    isputra Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    576
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Mbelitar
    Nope.. still not works.

    I think that there is something wrong with sshd_config because some parameter write double like :

    PasswordAuthentication yes
    UsePAM yes

    That's why i need another sshd_config to look for
     
  8. nyjimbo

    nyjimbo Well-Known Member

    Joined:
    Jan 25, 2003
    Messages:
    1,125
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    New York
    Just to clarify things, did you do the pageant part where you locally add the key to pageant and it then verifies the password BEFORE you attempt to logon to your system via SSH?. Did that portion work?. If not, then you have a bad private key. If it DID then you at least verified the private key is valid and removed that as an possible issue.

    If you really cannot get a copy of sshd_config the just go to any of the openssh mirrors (like ftp://ftp3.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/ ) and download any of the up to date versions of openssh and unpack it on your PC. Inside there is the sshd_config file in its original format.
     
    #8 nyjimbo, Apr 12, 2008
    Last edited: Apr 12, 2008
  9. screege

    screege Well-Known Member

    Joined:
    Aug 11, 2004
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    I have a similar problem but not with root it actualkly works fine, I am using penguinet and when adding another user I generate the keys, authorize them and they even get in /root/.ssh/user and user.pub I even put shell access under whm but when trying to login it keeps asking me my username what should I put there? I am putting the cpanel user name as I generated the key also with the same name.

    Thanks if anyone can help me.
     
Loading...

Share This Page