<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sewn</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sewn"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Sewn"/>
	<updated>2026-05-13T18:19:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=TTY_Autologin&amp;diff=26858</id>
		<title>TTY Autologin</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=TTY_Autologin&amp;diff=26858"/>
		<updated>2024-06-23T17:26:22Z</updated>

		<summary type="html">&lt;p&gt;Sewn: Add note for setting permission bit for script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=By using agetty=&lt;br /&gt;
&lt;br /&gt;
== How ==&lt;br /&gt;
Install {{pkg|agetty}}: {{cmd|# apk add agetty}}&lt;br /&gt;
Edit {{path|/etc/inittab}} to use agetty&amp;lt;br&amp;gt;&lt;br /&gt;
Example for the virtual terminal tty1:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tty1::respawn:/sbin/agetty --autologin root tty1 linux&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example inittab entry for a serial terminal on ttys01:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ttyS0::respawn:/sbin/agetty --autologin root ttyS0 vt100&amp;lt;/code&amp;gt;&lt;br /&gt;
{{tip|You can change the `tty1` or `ttyS0` to a different serial port or virtual terminal as you please. `root` can be changed to a different user as well. Finally the terminal type (`linux` and `vt100` in our examples) can be changed to a wide variety of serial terminals.}}&lt;br /&gt;
&lt;br /&gt;
=By making your own autologin wrapper=&lt;br /&gt;
&lt;br /&gt;
== How ==&lt;br /&gt;
# Writing a wrapper script, called autologin, around {{path|/bin/login}} and moving it in {{path|/usr/sbin/}}&lt;br /&gt;
# Editing {{path|/etc/inittab}} specifying the use of {{path|/usr/sbin/autologin}} instead of {{path|/bin/login}}&lt;br /&gt;
&lt;br /&gt;
== Writing the autologin script ==&lt;br /&gt;
&lt;br /&gt;
Edit and create the script in this example in the location {{path|/usr/sbin/autologin}}:&lt;br /&gt;
&lt;br /&gt;
{{cat|/usr/sbin/autologin|#!/bin/sh&lt;br /&gt;
exec login -f root}}&lt;br /&gt;
&lt;br /&gt;
Remember to make the scripts executable:&lt;br /&gt;
{{cmd|# chmod +x /usr/sbin/autologin}}&lt;br /&gt;
&lt;br /&gt;
The script executes the &#039;&#039;login&#039;&#039; binary (part of busybox) which will be searched in $PATH.&lt;br /&gt;
&lt;br /&gt;
As parameters are passed:&lt;br /&gt;
* &#039;&#039;&#039;-f&#039;&#039;&#039;  flag which stands for &amp;quot;Do not authenticate (user already authenticated)&amp;quot;&lt;br /&gt;
* &#039;&#039;username&#039;&#039; in this example is &#039;&#039;root&#039;&#039; but if you created a new user, its username can be used instead.&lt;br /&gt;
&lt;br /&gt;
== Editing /etc/inittab ==&lt;br /&gt;
&lt;br /&gt;
Open {{path|/etc/inittab}}&lt;br /&gt;
&lt;br /&gt;
replace &amp;quot;&#039;&#039;:respawn:/sbin/getty&#039;&#039;&amp;quot; with &amp;quot;&#039;&#039;:respawn:/sbin/getty -n -l /usr/sbin/autologin&#039;&#039;&amp;quot; for each TTY you want to enable autologin.&lt;br /&gt;
* The getty&#039;s &#039;&#039;&#039;-n&#039;&#039;&#039; flag do not prompt the user for a login name&lt;br /&gt;
* The getty&#039;s &#039;&#039;&#039;-l&#039;&#039;&#039; flag invokes a custom login instead of {{path|/bin/login}}; in our case it is set to invoke {{path|/usr/sbin/autologin}}&lt;br /&gt;
&lt;br /&gt;
==== Note ====&lt;br /&gt;
To perform such a replacement on all TTYs, the following command can be used:&lt;br /&gt;
{{Cmd|# sed -i &#039;s@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g&#039; /etc/inittab }}&lt;br /&gt;
* &amp;quot;&#039;&#039;&#039;@&#039;&#039;&#039;&amp;quot; is used as a delimiter&lt;br /&gt;
* The &#039;&#039;&#039;-i&#039;&#039;&#039; flag edits the file in-place&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://git.busybox.net/busybox/tree/init/init.c Busybox init source, substantial comments documenting /etc/inittab are at the bottom]&lt;br /&gt;
* [http://littlesvr.ca/linux-stuff/articles/autologinconsole/autologinconsole.php Linux-Stuff: Log in automatically to a console when Linux boots]&lt;br /&gt;
* [https://wiki.gumstix.com/index.php/AutoLogin AutoLogin - Gumstix User Wiki]&lt;br /&gt;
* [https://busybox.net/downloads/BusyBox.html#getty Busybox getty arguments]&lt;br /&gt;
* [https://github.com/util-linux/util-linux/blob/master/term-utils/agetty.8.adoc agetty(8) Manual Page]&lt;/div&gt;</summary>
		<author><name>Sewn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=TTY_Autologin&amp;diff=26857</id>
		<title>TTY Autologin</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=TTY_Autologin&amp;diff=26857"/>
		<updated>2024-06-23T17:23:04Z</updated>

		<summary type="html">&lt;p&gt;Sewn: Avoid making a C program and just use a script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=By using agetty=&lt;br /&gt;
&lt;br /&gt;
== How ==&lt;br /&gt;
Install {{pkg|agetty}}: {{cmd|# apk add agetty}}&lt;br /&gt;
Edit {{path|/etc/inittab}} to use agetty&amp;lt;br&amp;gt;&lt;br /&gt;
Example for the virtual terminal tty1:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tty1::respawn:/sbin/agetty --autologin root tty1 linux&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example inittab entry for a serial terminal on ttys01:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ttyS0::respawn:/sbin/agetty --autologin root ttyS0 vt100&amp;lt;/code&amp;gt;&lt;br /&gt;
{{tip|You can change the `tty1` or `ttyS0` to a different serial port or virtual terminal as you please. `root` can be changed to a different user as well. Finally the terminal type (`linux` and `vt100` in our examples) can be changed to a wide variety of serial terminals.}}&lt;br /&gt;
&lt;br /&gt;
=By making your own autologin wrapper=&lt;br /&gt;
&lt;br /&gt;
== How ==&lt;br /&gt;
# Writing a wrapper script, called autologin, around {{path|/bin/login}} and moving it in {{path|/usr/sbin/}}&lt;br /&gt;
# Editing {{path|/etc/inittab}} specifying the use of {{path|/usr/sbin/autologin}} instead of {{path|/bin/login}}&lt;br /&gt;
&lt;br /&gt;
== Writing the autologin script ==&lt;br /&gt;
&lt;br /&gt;
Edit and create the script in this example in the location {{path|/usr/sbin/autologin}}:&lt;br /&gt;
&lt;br /&gt;
{{cat|/usr/sbin/autologin|#!/bin/sh&lt;br /&gt;
exec login -f root}}&lt;br /&gt;
&lt;br /&gt;
The script executes the &#039;&#039;login&#039;&#039; binary (part of busybox) which will be searched in $PATH.&lt;br /&gt;
&lt;br /&gt;
As parameters are passed:&lt;br /&gt;
* &#039;&#039;&#039;-f&#039;&#039;&#039;  flag which stands for &amp;quot;Do not authenticate (user already authenticated)&amp;quot;&lt;br /&gt;
* &#039;&#039;username&#039;&#039; in this example is &#039;&#039;root&#039;&#039; but if you created a new user, its username can be used instead.&lt;br /&gt;
&lt;br /&gt;
== Editing /etc/inittab ==&lt;br /&gt;
&lt;br /&gt;
Open {{path|/etc/inittab}}&lt;br /&gt;
&lt;br /&gt;
replace &amp;quot;&#039;&#039;:respawn:/sbin/getty&#039;&#039;&amp;quot; with &amp;quot;&#039;&#039;:respawn:/sbin/getty -n -l /usr/sbin/autologin&#039;&#039;&amp;quot; for each TTY you want to enable autologin.&lt;br /&gt;
* The getty&#039;s &#039;&#039;&#039;-n&#039;&#039;&#039; flag do not prompt the user for a login name&lt;br /&gt;
* The getty&#039;s &#039;&#039;&#039;-l&#039;&#039;&#039; flag invokes a custom login instead of {{path|/bin/login}}; in our case it is set to invoke {{path|/usr/sbin/autologin}}&lt;br /&gt;
&lt;br /&gt;
==== Note ====&lt;br /&gt;
To perform such a replacement on all TTYs, the following command can be used:&lt;br /&gt;
{{Cmd|# sed -i &#039;s@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g&#039; /etc/inittab }}&lt;br /&gt;
* &amp;quot;&#039;&#039;&#039;@&#039;&#039;&#039;&amp;quot; is used as a delimiter&lt;br /&gt;
* The &#039;&#039;&#039;-i&#039;&#039;&#039; flag edits the file in-place&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://git.busybox.net/busybox/tree/init/init.c Busybox init source, substantial comments documenting /etc/inittab are at the bottom]&lt;br /&gt;
* [http://littlesvr.ca/linux-stuff/articles/autologinconsole/autologinconsole.php Linux-Stuff: Log in automatically to a console when Linux boots]&lt;br /&gt;
* [https://wiki.gumstix.com/index.php/AutoLogin AutoLogin - Gumstix User Wiki]&lt;br /&gt;
* [https://busybox.net/downloads/BusyBox.html#getty Busybox getty arguments]&lt;br /&gt;
* [https://github.com/util-linux/util-linux/blob/master/term-utils/agetty.8.adoc agetty(8) Manual Page]&lt;/div&gt;</summary>
		<author><name>Sewn</name></author>
	</entry>
</feed>