Can not edit package via api if it not begins with root_ in name
Hi,
I have root access to my server, and I want to edit packages using the WHM API, but I am having the error "_modpkg" require a package name that you have permission to access.
If the package_name starts with root_ I am allowed to edit it; also, if I create a package using api, it starts with root_ in the name.
The issue is that I already have several packages created using the whm panel (non-api) which didn't start with root_ in the name. Shouldn't I be able to edit these packages with a api token too?
Thank you.
-
To confirm you're using WHM API 1 Functions - editpkg - Developer Documentation - cPanel Documentation And what are the parameters you're using exactly? I tested this on my own server and I'm not seeing any issues [root@server packages]# whmapi1 editpkg name=cptest_usercreatedpackage featurelist=default quota=10240 language=en max_emailacct_quota=1024 maxftp=unlimited maxsql=unlimited maxpop=unlimited maxlists=unlimited maxsub=5 maxpark=5 maxaddon=5 --- data: pkg: cptest_usercreatedpackage metadata: command: editpkg reason: OK result: 1 version: 1
I created this package with my reseller account, within WHM, then logged in through terminal and ran the command line function. I'm also unable to replicate package addition automatically appending root to the package:[root@server packages]# whmapi1 addpkg name=package1234 featurelist=default quota=unlimited --- data: pkg: package1234 metadata: command: addpkg reason: OK result: 1 version: 1
[root@server packages]# ls -lah /var/cpanel/packages/package1234 -rw-r--r-- 1 root root 355 Jun 16 14:19 /var/cpanel/packages/package12340 -
Hi, I am using WHM api. If I run whmapi1 using the terminal, I can edit any package that I want. But I am using the API via CURL, and if I create a package with my token, it get prepended with "root" in the name automatically. Also, if I try to edit any package that not begins with "root_" I got the previous error. If I try to edit it any package that starts with "root_" it works fine. A minimalist example is: [CODE=bash]curl -XGET -H 'Authorization: whm root:MYTOKEN' -d 'name=TESTE' 'https://myserver:2087/json-api/editpkg'
It will return the previous error. If I run [CODE=bash]curl -XGET -H 'Authorization: whm root:MYTOKEN' -d 'name=TESTE' 'https://myserver:2087/json-api/addpkg'
then the package root_TESTE is created.0
Please sign in to leave a comment.
Comments
2 comments