mirror of
https://github.com/Corsinvest/cv4pve-api-php.git
synced 2026-04-25 04:25:48 +03:00
[GH-ISSUE #27] Bug Change Password VM #23
Labels
No labels
enhancement
needs investigation
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cv4pve-api-php#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SergioTGSerra on GitHub (Jan 1, 2024).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-php/issues/27
What happened?
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.
[CODE=php]$data = $pve->getNodes()->get($node)->getQemu()->get($vmid)->getAgent()->getSetUserPassword()->setUserPassword('Administrator', 'QAZ2wsx2')->getResponse();
return $data;[/CODE]
When I do this command I get the API response like:
[CODE=json]{"data": null}[/CODE]
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.
[CODE=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;
[/CODE]
[CODE=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}}]}}
[/CODE]
Then I changed the password through the proxmox shell with the following command and the password is changed:
[CODE=bash]qm guest passwd 104 root -password QAZ2wsx[/CODE]
I tried to change the username to root and with that user the error message appears.
[CODE=php]$data = $pve->getNodes()->get($node)->getQemu()->get($vmid)->getAgent()->getSetUserPassword()->setUserPassword('root', 'QAZ2wsx2')->getResponse();
return $data;[/CODE]
[CODE=json]{"errors":{"password":"value must be at least 5 characters long"},"data":null}[/CODE]
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
Expected behavior
Change Password
Relevant log output
No response
PHP Version
8.1
Proxmox VE Version
8.1.3
Version (bug)
1
Version (working)
No response
On what operating system are you experiencing the issue?
Linux
Pull Request