Skip to main content
Commonmark migration
Source Link

From the Arch wiki:

To configure auto-login for a systemd-nspawn container, override console-getty.service:

 
# /etc/systemd/system/console-getty.service.d/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud console 115200,38400,9600 $TERM 
 

If machinectl login my-container method is used to access the container, also add --autologin USERNAME to [email protected] template that manages pts/[0-9] pseudo ttys:

 
# /etc/systemd/system/[email protected]/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud pts/%I 115200,38400,9600 $TERM 

I've used this in practice for nsbox, and it's worked quite well with one catch: agetty will also proceed to start a shell, thus your bashrc/zshrc will be run and you may have an ugly prompt printed to the console that ran nspawn. Not a deal breaker but something worth noting...

From the Arch wiki:

To configure auto-login for a systemd-nspawn container, override console-getty.service:

 
# /etc/systemd/system/console-getty.service.d/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud console 115200,38400,9600 $TERM 
 

If machinectl login my-container method is used to access the container, also add --autologin USERNAME to [email protected] template that manages pts/[0-9] pseudo ttys:

 
# /etc/systemd/system/[email protected]/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud pts/%I 115200,38400,9600 $TERM 

I've used this in practice for nsbox, and it's worked quite well with one catch: agetty will also proceed to start a shell, thus your bashrc/zshrc will be run and you may have an ugly prompt printed to the console that ran nspawn. Not a deal breaker but something worth noting...

From the Arch wiki:

To configure auto-login for a systemd-nspawn container, override console-getty.service:

# /etc/systemd/system/console-getty.service.d/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud console 115200,38400,9600 $TERM 

If machinectl login my-container method is used to access the container, also add --autologin USERNAME to [email protected] template that manages pts/[0-9] pseudo ttys:

# /etc/systemd/system/[email protected]/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud pts/%I 115200,38400,9600 $TERM 

I've used this in practice for nsbox, and it's worked quite well with one catch: agetty will also proceed to start a shell, thus your bashrc/zshrc will be run and you may have an ugly prompt printed to the console that ran nspawn. Not a deal breaker but something worth noting...

Source Link

From the Arch wiki:

To configure auto-login for a systemd-nspawn container, override console-getty.service:

# /etc/systemd/system/console-getty.service.d/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud console 115200,38400,9600 $TERM 

If machinectl login my-container method is used to access the container, also add --autologin USERNAME to [email protected] template that manages pts/[0-9] pseudo ttys:

# /etc/systemd/system/[email protected]/override.conf [Service] ExecStart= ExecStart=-/sbin/agetty --noclear --autologin username --keep-baud pts/%I 115200,38400,9600 $TERM 

I've used this in practice for nsbox, and it's worked quite well with one catch: agetty will also proceed to start a shell, thus your bashrc/zshrc will be run and you may have an ugly prompt printed to the console that ran nspawn. Not a deal breaker but something worth noting...