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
27
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...
 
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!
 
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 :(
 
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
 
  • Like
Reactions: KipiK
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
 
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!
 
  • Like
Reactions: KipiK
Hi! First post here, sorry if I revive this but hope that help future people in the same situation.
This might be obvious for other but I look the entire www and could find the answer until I reed in the file itself

# systemctl edit container-getty@.service

if you check closely you can see where the line provided by ikke must be set. if you uncomment the same line bellow it won't work, it has to be between this if not you may end up with this error systemctl edit failed (canceled: temporary file is empty)

### Anything between here and the comment below will become the new contents of the file
and this
### Lines below this comment will be discarded

Hope that help ! (This forum is amazing)
SCR-20230227-rl7.png
 
Last edited:

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!