[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!
 

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!