Proxmox VE uses token based authentication not support option skiplock(Only root may use)

shining

New Member
Jun 6, 2022
9
0
1
Proxmox VE uses token based authentication not support option skiplock(Only root may use)
Use cookie authorization is ok.

delete vm api
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}


Code:
APINODE=10.0.0.160
TARGETNODE=pve2
VMID=106
curl -v --insecure -X DELETE -H 'Authorization: PVEAPIToken=root@pam!root_tokenid=xxxxxx' "https://$APINODE:8006/api2/json/nodes/$TARGETNODE/qemu/$VMID?destroy-unreferenced-disks=0&purge=1&skiplock=1" | jq '.'

Code:
return:
{
  "data": null,
  "errors": {
    "skiplock": "Only root may use this option."
  }
}
 
As you already included in your post, the skiplock parameter is limited to be only used by the root user. In the backend, this is a very hard check against "root@pam". A root user token will never pass this check as the token name is appended to the username.

Therefore, this behaviour is expected. If you want to use API calls that implement the skiplock option, you will have to do so with the system's root user. I.e. using cookie authorization.

(Nonetheless, if I misunderstood something about your question, feel free to let me know!)
 
I see, "Only root use" option,not support uses token based authentication.
thanks a lot