How to execute custom shell commands on Proxmox host via API?

ksl28

Member
Aug 31, 2023
35
4
8
Hi everyone,


I need to execute custom shell commands on Proxmox hosts to gather additional hardware information that's not exposed through the standard API endpoints.


What I need:I want to run commands like
Code:
dmidecode -s system-serial-number
directly on the Proxmox host to collect hardware details not available via /nodes/{node}/hardware.


What I've tried:I found the /nodes/{node}/execute endpoint, but the documentation indicates this is for executing Proxmox API commands in batch, not shell commands on the host itself.


Question:Is there a way to execute custom shell commands on a Proxmox host via the REST API, or do I need to use SSH for this type of system introspection?


Any guidance would be much appreciated!


Thanks!
 
I guess this could pose a security issue if allowed?
You could surely do some harm, and the people that wants to use it, should understand API permissions :)

But from my point of view, if i can do it over SSH with the same user, then its the same "risk".
From the API today i can also do things like delete VMs, delete datastores (i assume), etc - so i can already do quite a lot of harm.

But i agree with your point :)