Is it possible create SSH keys to cPanel user account instead user root via API?

Otávio Serra

Well-Known Member
Apr 27, 2015
46
10
58
Brazil
cPanel Access Level
Root Administrator
I'm making some integrations with cPanel using WHM API1 and cPanel UAPI to create in my app some GIT repositories and intend to gave it access via SSH KEY. I use one root ssh key to make request to others cpanel's accounts globally. But I can't find options to make this keys owner to one cPanel user account, only option to made it for the user that make this requisition that is the root.

Anybody knows some fix to solve this? Is possible it from API or it's only for root's admin porpouse?

Thanks
 

Otávio Serra

Well-Known Member
Apr 27, 2015
46
10
58
Brazil
cPanel Access Level
Root Administrator
Hey there! cPanel users also have a .ssh/authorized_keys file, so you could setup the key just same as you could with the root user. Just add the .pub version of the key to that file and you're all set.
Hi,

Here you can see how to create this key: https://api.docs.cpanel.net/openapi/whm/operation/generatesshkeypair/ . So, I have some questions about this option that you suggest to me:

  1. This key owner will be root?
  2. This key ins't auto apply to root user in .ssh/authorized_keys of it's user?
Thanks for now