How to Access a cPanel Account through WHM
I need to be able to add an email account to a cPanel account through WHM, is this possible?
I plan to build this into a interface where my clients can add email accounts without seeing cPanel.
I can't create a token for the cPanel account, as I have well over 300 clients.
-
With root access, you'd simply call the cPanel UAPI functions on behalf of the users. This concept is usually referred to as "masquerading". It would look something like this over bash/CLI: uapi --user= Email add_pop email='user' password='123456luggage'
Here is the full documentation on the API function: Create email address " cPanel & WHM Developer Portal0 -
I don't have root access, I am a Reseller. I can access the cURL API and that's it 0 -
[CODE=php]$ch2 = curl_init( 'https://lima.example.io:2087/json-api/create_user_session?api.version=1&user=%40&service=cpaneld' ); curl_setopt($ch2, CURLOPT_HTTPHEADER, array( 'Authorization: cpanel', ': ' )); curl_setopt( $ch2, CURLOPT_RETURNTRANSFER, true ); $stack = curl_exec($ch2); curl_close($ch2);
I have tried this, but it won't work any pointers? I was going to do this > Create a Session(from WHM token) > Use session to add email, domains etc0 -
Fixed. I have managed to create a cpsess for a cPanel account through WHM API using a Token. [CODE=php]/cpsess9617913732/json-api/cpanel?cpanel_jsonapi_user=&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=addpop&domain=&email=example&password=eXample!10!
However, upon using that cpsess to access Email Module, I keep getting 'Access Denied'.0
Please sign in to leave a comment.
Comments
5 comments