[SOLVED] Create user with API

sozie

Member
Apr 5, 2020
33
3
13
33
Paris, France
shiftek.fr
Hello,

I am currently trying to create an automation via the Proxmox API. The problem is that the ROOT connection is disabled on the templates.

I don't want to recreate myself templates with root active. So, is it possible to create a user with a specific password on a LXC via the Proxmox API?

Thank you in advance for your various answers.
Cdt.
 
Not sure I understand the question completely.
Do you want to create a user inside a LXC container (before converting it to a template)?
If yes - this can currenly only be done via the CLI (`pct exec useradd yournewuser`)

if no - please explain a bit more what you want to achieve

Thanks!
 
Hello @Stoiko Ivanov !

Thanks for your answer. It's true that I may have badly explained what I wanted, and that I'm not very good in English ^^!

So, as you must know, when you download a LXC Template, by default in /etc/ssh/sshd.conf the "PermitRootLogin" is disabled.

I'm currently creating a webhost (without WHMCS, or whatever, completely by hand). So for the automation of the command, I use the Proxmox API. And so, I would like to know how I could create a user (other than root) with a password on the LXC container I created.

I hope you will be able to understand my request in spite of my English which is not very reliable.

Thanks in advance,
Rémi.
 
As said - running commands inside the container can only be done via commandline currently (for a running container `pct exec`)
but you can download a fresh template, create a container, modify it according to your needs, stop it, make it a template and then create clones of that container (which will have all modifications present)

I hope this helps!