Steven.C

Member
Mar 24, 2008
7
0
51
/json-api/cpanel?cpanel_jsonapi_user=root&cpanel_jsonapi_module=SSH&cpanel_jsonapi_func=genkey&cpanel_jsonapi_version=2&bits=2048&type=rsa&name=test&pass=XZY123

produces error...

Code:
Internal Server Error

Could not setuid to root at /usr/local/cpanel/Whostmgr/XMLUI/cPanel.pm line 82.

 at /usr/local/cpanel/Whostmgr/XMLUI/cPanel.pm line 82
	Whostmgr::XMLUI::cPanel::cpanel_exec('HASH(0xc63390)', 'IO::Socket::SSL=GLOB(0xf1af120)', 1, 'HASH(0xf0f7b00)') called at cpsrvd-ssl line 5742
	main::dodoc_whostmgrd() called at cpsrvd-ssl line 1489
	main::dodoc('HASH(0xca30b0)') called at cpsrvd-ssl line 1214
	main::handle_one_connection() called at cpsrvd-ssl line 875
Doing so for any regular user works just fine. I may have been up too long to think, but the issue is not jumping out at me. Any assistance would be appreciated.
 

JaredR.

Well-Known Member
Feb 25, 2010
1,834
23
143
Houston, TX
cPanel Access Level
Root Administrator
The problem is that you are effectively trying to log in and call a cPanel function as root. As you noted, it works when you use a cPanel account user, not as root. You would get the same error if you tried to log into a user's cPanel by entering "root" into the username field in the log-in box.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
At this time we don't provide a remote API function to generate SSH keys for the root user.