LXC PermitRootLogin

MacFresno

Member
Apr 30, 2017
7
0
6
29
Hello, I have newly installed Proxmox 4.4 and downloaded your default LXC templates, how can I allow root login by default? I have decompressed the tars, changed /etc/ssh/sshd_config and recompressed it, but the setting is still without-password or prohibit-password.

Thanks in advance.
 
Hi,

What is your template ?
If I understand correctly you create a new template just with one:

Code:
PermitRootLogin yes

In the sshd config
 
Nono, I've downloaded the ubuntu, debian and centos templates from the panel, and some of them had PermitRootLogin withiut-password, I decompressed these templates, changed PermitRootLogin to yes and re-compressed them, but some are still not working. There is some king of script post-install that could be interfering?
 
No, actually to make a template you have to create the container. Start it. Make the change from in. Make the backup of it. And transfer it to the templates folder.

Code:
cp /mnt/HDD/dump/vzdump-lxc-date.tar /var/lib/vz/template/cache/
mkdir tmp
tar xvf vzdump-lxc-date.tar -C tmp/
cd tmp
tar zcvf new_name_template.tar.gz .
cp new_name_template.tar.gz ../
cd ..
rm -rf tmp

try this.
 
No, actually to make a template you have to create the container.

That's wrong. The procedure @MacFresno uses works, I use it regularly with a lot of different containers. It's just a simple chroot environment and uses the roughly the same command sequence as you (@Xilmen) pointed out, yet simpler the cd tmp, cp and cd .. can be omitted if you tar your file correctly - also with -C
 
Hi all, @MacFresno ,

I am also interested in your solution. Do you have a script file to update automatically templates to do that ?

I am in the same situation; I updated templates with a new "etc/ssh/sshd_config", unfortunatelly, when I deploy a new container with that template, the file still looks like as before the modifications, that is to stay with "prohibit-password" for root. How did you solve this ?

I would like to avoid the @Xilmen solution using dumps.

Best regards
Rémy

edit : ok, after recreating the tarball it works fine. It seems that the tar update did not work fine (the etc/ssh/sshd_config has not been overwrite properly).
 
Last edited: