Already added public SSH key to cPanel, but keeps asking password

D

Deleted member 976381

Guest
Hello, I have created on my local machine a new SSH key, also copied it to the cPanel account using:

Code:
ssh-copy-id -i ~/.ssh/<new_key_name>.pub -p <port_number> <user_name>@<IP>
Code:
Number of key(s) added: 1
I can see that on my cPanel account, on the .ssh folder the file `authorized_keys` was also modified.

The issue is that when trying to connect via SSH, it keeps asking for the password.
Any ideas?
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
D

Deleted member 976381

Guest
If you go to cPanel>>Security>>SSH Access and create the key there following the instructions here: SSH Access - Version 84 Documentation - cPanel Documentation does the issue persist?
Yes, maybe I'm doing it wrong...

On cPanel>>Security>>SSH Access>>Manage SSH Keys>>Import Key
I have imported the public key created at my local machine and added the same name as the one created on local.

I can see that the key was added on cPanel and it's authorized. Also I see .ssh folder updated and added my pub key file.

The issue is when trying to connect from my local machine, it still asks for password.
Also tried to use the ssh key generated as:
Code:
ssh -i ~/.ssh/<new_key_name> -p <port_number> <user_name>@<IP>
Still no luck
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
That sounds correct. Since it doesn't appear that you have root access to the system, being a reseller owner, you might contact your provider and ask if they can restart the ssh service - when this is complete try logging in with the SSH key once more.
 
D

Deleted member 976381

Guest
That sounds correct. Since it doesn't appear that you have root access to the system, being a reseller owner, you might contact your provider and ask if they can restart the ssh service - when this is complete try logging in with the SSH key once more.
I've restarted SSH service from WHM, but the same keeps happening. The password is asked again and again :(

Any other ideas for me to try?
 
D

Deleted member 976381

Guest
Hi @danielcharrua

You might contact your provider, they may have some insight into what's going wrong that you're not able to access.
The issue was solved, I've managed to connect via SSH.
The problem was that after restarted SSH service on the server, I've found that the SSH key uploaded via cPanel was unauthorized, that's why it still asked me for the password.

The command I use to connect is:

Code:
ssh -i ~/.ssh/<new_key_name> -p <port_number> <user_name>@<IP>
I know this can be more clean using a ssh config file, I'll investigate on those.
Thank you very much
 
  • Like
Reactions: cPanelLauren