Create SSH Keys and login using putty - access denied

RSCChris

Active Member
Sep 15, 2004
26
0
151
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.
 

isputra

Well-Known Member
May 3, 2003
575
0
166
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.
 

jayh38

Well-Known Member
Mar 3, 2006
1,213
0
166
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.
 

isputra

Well-Known Member
May 3, 2003
575
0
166
Mbelitar
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.
Hi,
still not works.

-------------------------
login as: root
Authenticating with public key "rsa-key-root"
Passphrase for key "rsa-key-root":
Access denied
[email protected]'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.
 
Last edited:

nyjimbo

Well-Known Member
Jan 25, 2003
1,136
1
168
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.
 

isputra

Well-Known Member
May 3, 2003
575
0
166
Mbelitar
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.
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
 

nyjimbo

Well-Known Member
Jan 25, 2003
1,136
1
168
New York
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
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.
 
Last edited:

screege

Well-Known Member
Aug 11, 2004
190
1
166
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.