I'm using x cv4pve-api-php to communicate with the api
I'm trying to reset the password of a vm using the proxmox API.
When I do this command I get the API response like:
I went to vm but the password is not changed. So I tried the following commands to check if communication to the VM was working and yes it was.
Then I changed the password through the proxmox shell with the following command and the password is changed:
I tried to change the username to root and with that user the error message appears.
I can't understand why this happened since the root user does not exist in the vm's OS.
If anyone can help I would be grateful. Thanks
I'm trying to reset the password of a vm using the proxmox API.
PHP:
$data = $pve->getNodes()->get($node)->getQemu()->get($vmid)->getAgent()->getSetUserPassword()->setUserPassword('Administrator', 'QAZ2wsx2')->getResponse();
return $data;
When I do this command I get the API response like:
JSON:
{"data": null}
I went to vm but the password is not changed. So I tried the following commands to check if communication to the VM was working and yes it was.
PHP:
$data1 = $pve->getNodes()->get($node)->getQemu()->get($vmid)->getAgent()->getGetUsers()->getUsers()->getResponse();
$data2 = $pve->getNodes()->get($node)->getQemu()->get($vmid)->getAgent()->getNetworkGetInterfaces()->networkGetInterfaces()->getResponse();
return $data1;
return $data2;
JSON:
{"data":{"result":[{"user":"Administrator","login-time":1703928164.75337,"domain":"WIN-42DB1GRE758"}]}}
{"data":{"result":[{"name":"Ethernet","statistics":{"rx-bytes":37858,"tx-dropped":0,"tx-errs":0,"rx-packets":16,"rx-errs":0,"rx-dropped":0,"tx-bytes":7751,"tx-packets":13},"hardware-address":"bc:24:11:7b:69:b1","ip-addresses":[{"prefix":64,"ip-address-type":"ipv6","ip-address":"fe80::8629:4e3c:bc25:63e3%14"},{"prefix":24,"ip-address-type":"ipv4","ip-address":"163.172.112.35"},{"ip-address":"169.254.165.33","ip-address-type":"ipv4","prefix":16}]},{"name":"Loopback Pseudo-Interface 1","ip-addresses":[{"ip-address-type":"ipv6","prefix":128,"ip-address":"::1"},{"ip-address":"127.0.0.1","ip-address-type":"ipv4","prefix":8}],"statistics":{"rx-bytes":0,"tx-errs":0,"tx-dropped":0,"rx-packets":0,"rx-errs":0,"rx-dropped":0,"tx-bytes":0,"tx-packets":0}}]}}
Then I changed the password through the proxmox shell with the following command and the password is changed:
Bash:
qm guest passwd 104 root -password QAZ2wsx
I tried to change the username to root and with that user the error message appears.
PHP:
$data = $pve->getNodes()->get($node)->getQemu()->get($vmid)->getAgent()->getSetUserPassword()->setUserPassword('root', 'QAZ2wsx2')->getResponse();
return $data;
JSON:
{"errors":{"password":"value must be at least 5 characters long"},"data":null}
I can't understand why this happened since the root user does not exist in the vm's OS.
If anyone can help I would be grateful. Thanks
Last edited: