[pve-devel] Set Password for LCX Container with API create

Fabian Gr├╝nbichler f.gruenbichler at proxmox.com
Mon Jan 30 15:59:49 CET 2017

> Detlef Bracker <bracker at 1awww.com> hat am 30. Januar 2017 um 14:39 geschrieben:
> Dear Marco,
> thats not possible! In the man page is written, that is so possible, but
> the value cant been send with pct create!

Not true, the man page says that you can pass "-password" to set the root password[1], not that the "password" parameter takes a string value and sets that value as password.

> Thats give same as in the api an error "to much parameters"!

I guess you mean via pvesh, and not via the API? pvesh has its own internal password handling, like pct has. This is intentional, because you don't want passwords to visible in the process list and/or history.

> When you send only "pct create -password" then the shell ask for the
> password! But this is not handable for batches!

If you want to batch create containers, you can do so via the API (the actual one that you can use over HTTPS). Like the api-viewer[2] says, the API path "POST /api2/json/nodes/{node}/lxc" has an optional string parameter that allows directly setting the password.

Please also note that neither the API nor the "pct create" command require setting a password, you can also pass one or more public SSH keys (which are of course by nature not as sensitive as plain text passwords, and thus do not have the same constraints), or even nothing at all (in which case, you need to use "pct exec" or "pct enter" to run stuff in the container).

Hope this clears things up.

1: http://pve.proxmox.com/pve-docs/pct.1.html
2: http://pve.proxmox.com/pve-docs/api-viewer/index.html

More information about the pve-devel mailing list