Is it possible to have containers auto login on the web gui like the node?

sooon_mitch

New Member
Dec 22, 2019
1
0
1
25
I have searched all over the forum and all over Google without success.

When I click on a container, and then shell, I get a prompt to login. I do NOT get this prompt when I select the node, then console. The node is automatically logged into the user.

Is it possible to achieve the same effect with the containers? (So that it is automatically logged in to a user without me providing user/password) If so, how would one achieve this? Any advice or documentation would be helpful.

I basically want to do this and use the web interface as a single point of entry into my server/containers. That way I can disable all ssh connections from outside the box and only use xterm.js from the web side. Plus this will make it easier so that I don't have to manage a password for each container...
 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
7,410
1,191
164
You could try reconfiguring the getty process on each container to use autologin - see the ArchWiki entry https://wiki.archlinux.org/index.php/getty

Haven't tried this here though - so it would be great if you report back how this works out!

In any case make sure to set or lock the passwords of all user and not leave them empty!

I hope this helps!
 
Jan 23, 2021
9
3
3
53
Geneva, Switzerland
You could try reconfiguring the getty process on each container to use autologin - see the ArchWiki entry https://wiki.archlinux.org/index.php/getty

Haven't tried this here though - so it would be great if you report back how this works out!

In any case make sure to set or lock the passwords of all user and not leave them empty!

I hope this helps!

Followed up instructions on that page, since i want to autorun a pihole setup on a LXC Container Debian (0-standard_10.7-1_amd64.tar.gz)

When booting i still have root/pwd prompt

Debian GNU/Linux 10 kpdns02 tty1
kpdns02 login: root

created /etc/systemd/system/getty@tty1.service.d/override.conf

with

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin root --noclear %I $TERM

no luck :(
 

JuanAntonio

New Member
May 6, 2021
2
0
1
30
Hello,

I recently had the same problem, I don't know if it will be the best method, but I solved it like this. With the root user modify the file:
/lib/systemd/system/container-getty\@.service

and in the section where the ExecStart is I put it like this:
ExecStart=-/sbin/agetty --autologin <user> --noclear --keep-baud tty%I 115200,38400,9600 $TERM

I hope you find it useful
 

JuanAntonio

New Member
May 6, 2021
2
0
1
30
Warning so that the same thing does not happen to you, be careful with the modifications you make and do it in containers that do not have anything important, I crashed the startup of a few before reaching this solution and I do not know if it will work in all cases
 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
7,410
1,191
164
I recently had the same problem, I don't know if it will be the best method, but I solved it like this. With the root user modify the file:
/lib/systemd/system/container-getty\@.service
sounds like the correct service to override - but I would suggest to not edit files in '/lib' directly (these would get overwritten on an upgrade to systemd!

use the override mechanism (`systemctl edit container-getty\@.service`) to make modifications.

I hope this helps!
 

ikke

New Member
May 19, 2021
9
4
3
I can confirm, this did the magic:

Code:
# systemctl edit container-getty@.service

fill in:

Code:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 $TERM

Save & reboot. Tested with Debian.
 

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 your own in 60 seconds.

Buy now!