pve api have call shell ?

haiwan

Well-Known Member
Apr 23, 2019
249
1
58
38
Hi, we want use api running shell
running eg: wget https ://www.abc.com/install.sh
if we use php, how to use api call this. tks please give me guide.
notice: just use api , no login pve web gui config. tks
 
Hey,

what you're looking for is POST /nodes/{node}/qemu/{vmid}/agent/exec and GET /api2/json/nodes/{node}/qemu/{vmid}/agent/exec-status. Note: The VM has to have the qemu-guest-agent[1] enabled.

Docs for the endpoints:
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/agent/exec
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/agent/exec-status

[1] https://pve.proxmox.com/wiki/Qemu-guest-agent
sorry, we no plan on qemu node running shell.
we wish direct pve node running shell use api
eg : in pve server shell running wget http://www/abc.com/install.sh & bash install.sh
 
The PVE API does not support arbitrary command execution. I'd recommend looking at some config management software like Ansible, or if it is only needed in a single instance, just SSH into the instance.

Note: running install.sh scripts may be dangerous so be sure to check what the script does before running it
 
Last edited: