pve api have call shell ?

haiwan

Well-Known Member
Apr 23, 2019
249
1
58
37
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:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!