Ssh - Disable root login with ssh keys

cashgold

Registered
Mar 20, 2014
3
0
1
cPanel Access Level
Reseller Owner
Hi,
I've disabled ssh access with password preferring doing it with ssh keys.
Now I want to disable ssh root access and add a new user to whell group.

I've created the new user via cli more than cpanel web interface, so I don't have to put fake information like domain and so on.
I've added the new user to the wheel group but at this point I'm stucked. I cannot ssh login with the new user because the server require an ssh key. From cpanel WHM I can generate ssh keys only for root, and from cpanel account administration panel (port 2083) I cannot access the user specific one because I created it via cli.

Thanks
 

cashgold

Registered
Mar 20, 2014
3
0
1
cPanel Access Level
Reseller Owner
I can access the ssh, I've not still disabled root login.
Just want to know how to allow non-root user to access ssh with an ssh-key (not password) After being successfully I'll disable root login.
I can create ssh key for non-root user through cpanel, but only if I create a cpanel account (with domain and additional infos)
I'm wondering how to create ssh keys for user created through cli (command adduser)

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

Yes, simply access SSH as the user using the account password and then generate a key with the instructions from the last post.

Thank you.
 

cashgold

Registered
Mar 20, 2014
3
0
1
cPanel Access Level
Reseller Owner
Solved applying dalem suggestion and duplicating the newly created key file in /home/newuser/.ssh and renaming it to authorized_keys
 

Sys Admin

Well-Known Member
Apr 29, 2007
67
0
156
cPanel Access Level
Root Administrator
Solved applying dalem suggestion and duplicating the newly created key file in /home/newuser/.ssh and renaming it to authorized_keys
Make sure to generate new keys (public & private) for each new user for security reasons.