Using guest-set-user-password command with qga

ispirto

Renowned Member
Oct 20, 2012
37
1
73
Hello,

Code:
root@internal2:/var/run/qemu-server# pveversion -v
proxmox-ve: 4.4-79 (running kernel: 4.4.35-2-pve)
pve-manager: 4.4-12 (running version: 4.4-12/e71b7a74)
pve-kernel-4.4.35-1-pve: 4.4.35-77
pve-kernel-4.4.35-2-pve: 4.4.35-79
lvm2: 2.02.116-pve3
corosync-pve: 2.4.0-1
libqb0: 1.0-1
pve-cluster: 4.0-48
qemu-server: 4.0-107
pve-firmware: 1.1-10
libpve-common-perl: 4.0-90
libpve-access-control: 4.0-23
libpve-storage-perl: 4.0-73
pve-libspice-server1: 0.12.8-1
vncterm: 1.2-1
pve-docs: 4.4-3
pve-qemu-kvm: 2.7.1-1
pve-container: 1.0-93
pve-firewall: 2.0-33
pve-ha-manager: 1.0-40
ksm-control-daemon: 1.2-1
glusterfs-client: 3.5.2-2+deb8u3
lxc-pve: 2.0.7-1
lxcfs: 2.0.6-pve1
criu: 1.6.0-1
novnc-pve: 0.5-8
smartmontools: 6.5+svn4324-1~pve80
zfsutils: 0.6.5.8-pve14~bpo80

I was wondering why the following command wouldn't work. It returns nothing and it doesn't change the guest's root password to "123456"

Code:
echo '{ "execute": "guest-set-user-password", "arguments": { "crypted": false, "username": "root", "password": "MTIzNDU2" } }' | socat /var/run/qemu-server/35643.qga -

Modified from http://git.qemu.org/?p=qemu.git;a=commitdiff;h=215a277

Seems the method is already there on the guest:

Code:
root@internal2:~# qm agent 35643 info
{
   "supported_commands" : [
      {
         "enabled" : true,
         "name" : "guest-set-user-password"
      },
      {
         "enabled" : true,
         "name" : "guest-set-vcpus"
      },
      {
         "enabled" : true,
         "name" : "guest-get-vcpus"
      },
      {
         "enabled" : true,
         "name" : "guest-network-get-interfaces"
      },
      {
         "enabled" : true,
         "name" : "guest-suspend-hybrid"
      },
      {
         "enabled" : true,
         "name" : "guest-suspend-ram"
      },
      {
         "enabled" : true,
         "name" : "guest-suspend-disk"
      },
      {
         "enabled" : true,
         "name" : "guest-fstrim"
      },
      {
         "enabled" : true,
         "name" : "guest-fsfreeze-thaw"
      },
      {
         "enabled" : true,
         "name" : "guest-fsfreeze-freeze"
      },
      {
         "enabled" : true,
         "name" : "guest-fsfreeze-status"
      },
      {
         "enabled" : false,
         "name" : "guest-file-flush"
      },
      {
         "enabled" : false,
         "name" : "guest-file-seek"
      },
      {
         "enabled" : false,
         "name" : "guest-file-write"
      },
      {
         "enabled" : false,
         "name" : "guest-file-read"
      },
      {
         "enabled" : false,
         "name" : "guest-file-close"
      },
      {
         "enabled" : false,
         "name" : "guest-file-open"
      },
      {
         "enabled" : true,
         "name" : "guest-shutdown"
      },
      {
         "enabled" : true,
         "name" : "guest-info"
      },
      {
         "enabled" : true,
         "name" : "guest-set-time"
      },
      {
         "enabled" : true,
         "name" : "guest-get-time"
      },
      {
         "enabled" : true,
         "name" : "guest-ping"
      },
      {
         "enabled" : true,
         "name" : "guest-sync"
      },
      {
         "enabled" : true,
         "name" : "guest-sync-delimited"
      }
   ],
   "version" : "0.12.1"
}

UPDATE:

Removing the spaces from the json string and rerunning it returned the following result:

Code:
root@internal2:/var/run/qemu-server# echo '{"execute":"guest-set-user-password","arguments":{"crypted":false,"username":"root","password":"MTIzNDU2"}}' | socat /var/run/qemu-server/35643.qga -
root@internal2:/var/run/qemu-server# socat /var/run/qemu-server/35643.qga -
{"error": {"class": "GenericError", "desc": "child process has failed to set user password", "data": {"message": "child process has failed to set user password"}}}

UPDATE:

It seems this was caused because of SELinux. I've disabled it on the guest and it worked.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1369699

I'm wondering if you guys are looking to implement this feature on "qm agent" command.
 
Last edited:
please file an enhancement request at bugzilla.proxmox.com (for qemu-server)
 

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!