Salta al contenuto principale

Alpine

Image
logo

Alpine Linux è una distribuzione Linux indipendente, non commerciale e generica progettata per utenti esperti che apprezzano la sicurezza, la semplicità e l'efficienza delle risorse.

Tipo Sistema Operativo
Linux

Bubblewrap/Examples

imv: Update why /bin/sh is needed

← Older revision Revision as of 01:00, 10 September 2023
Line 322: Line 322:


  --ro-bind /bin/sh /bin/sh \
  --ro-bind /bin/sh /bin/sh \
(Technically optional?) Needed to have the name of the file in the window title.
Needed to use {{Path|config}} and have various information in the window
title.


  ...
  ...
Distro

TTY Autologin

Creating the "TTY autologin" page

New page

What follows is one from many different ways to get autologin.

== How ==
# Writing a wrapper, called autologin, around /bin/login and moving it in /usr/sbin/
# Editing /etc/inittab specifying the use of /usr/sbin/autologin instead of /bin/login

== Prerequisites ==
* A C compiler
* The '''''musl-dev''''' package which contains the C standard library

==== Example on how to assolve the prerequisites: ====
{{Cmd|# apk add --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing tcc
# apk add musl-dev }}

== Writing the autologin.c program ==

Create a file; in this example called autologin.c
{{Cmd|# vi autologin.c }}

Write into it the following C program.

{{ cmd|&#35;include <unistd.h>

int main()
{
execlp( "login", "login", "-f", "root", 0);
}
}}

The only thing it does is a system call to execute the ''login'' binary (part of busybox) which will be searched in PATH.

As parameters are passed:
* '''-f''' flag which stands for "Do not authenticate (user already authenticated)"
* ''username'' in this example is ''root'' but if you created a new user, the user username can be used instead.

== Compiling the autologin.c program ==
If using tcc:
{{Cmd|&#35; tcc -o autologin autologin.c }}

Move the binary autologin to /usr/sbin
{{Cmd|&#35; mv autologin /usr/sbin/ }}

== Editing /etc/inittab ==

{{Cmd|&#35; sed -i 's@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g' /etc/inittab }}

The above command:
* replaces "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''"
* "'''@'''" is used as a delimiter
* The '''-i''' flag edits the file in-place
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-l''' flag invokes a custom login instead of /bin/login; in our case it is set to invoke /usr/sbin/autologin

== Cleaning up ==
It is possible to remove the autologin.c file, the C compiler and the '''musl-dev''' package
{{Cmd|&#35; rm autologin.c
&#35; apk del tcc
&#35; apk del musl-dev}}
Distro

Tutorials and Howtos

Adding the just created "TTY Autologin" page in "Miscellaneous"

← Older revision Revision as of 19:32, 10 September 2023
Line 282: Line 282:
== Miscellaneous ==
== Miscellaneous ==


* [[TTY_Autologin|TTY Autologin]]
* [[Kexec|Faster rebooting with kexec]]
* [[Kexec|Faster rebooting with kexec]]
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]
Distro

TTY Autologin

← Older revision Revision as of 20:00, 10 September 2023
(2 intermediate revisions by the same user not shown)
Line 43: Line 43:
== Editing /etc/inittab ==
== Editing /etc/inittab ==


Open /etc/inittab
{{Cmd|&#35; vi /etc/inittab }}
replace each "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''"
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-l''' flag invokes a custom login instead of /bin/login; in our case it is set to invoke /usr/sbin/autologin
==== Note ====
To perform such replacement the following command can be used:
{{Cmd|&#35; sed -i 's@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g' /etc/inittab }}
{{Cmd|&#35; sed -i 's@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g' /etc/inittab }}
The above command:
* replaces "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''"
* "'''@'''" is used as a delimiter
* "'''@'''" is used as a delimiter
* The '''-i''' flag edits the file in-place
* The '''-i''' flag edits the file in-place
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-l''' flag invokes a custom login instead of /bin/login; in our case it is set to invoke /usr/sbin/autologin


== Cleaning up ==
== Cleaning up ==
Line 57: Line 62:
&#35; apk del tcc
&#35; apk del tcc
&#35; apk del musl-dev}}
&#35; apk del musl-dev}}
== References ==
Distro

Talk:TTY Autologin

I don't understand.

New page

== Isn't this just reinventing the wheel? ==
Instead of going through the trouble of compiling something, wouldn't it be much easier to <code>apk add {{pkg|agetty}}</code> (from main) and use the {{key|-a}} (<small>{{key|--autologin}}</small>) option? &ndash;zcrayfish ([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]]) 02:13, 11 September 2023 (UTC)
Distro

TTY Autologin

← Older revision Revision as of 15:13, 11 September 2023
Line 32: Line 32:
As parameters are passed:
As parameters are passed:
* '''-f'''  flag which stands for "Do not authenticate (user already authenticated)"
* '''-f'''  flag which stands for "Do not authenticate (user already authenticated)"
* ''username'' in this example is ''root'' but if you created a new user, the user username can be used instead.
* ''username'' in this example is ''root'' but if you created a new user, its username can be used instead.


== Compiling the autologin.c program ==
== Compiling the autologin.c program ==
Line 47: Line 47:
{{Cmd|&#35; vi /etc/inittab }}
{{Cmd|&#35; vi /etc/inittab }}


replace each "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''"
replace "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''" for each TTY you want to enable autologin.
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-l''' flag invokes a custom login instead of /bin/login; in our case it is set to invoke /usr/sbin/autologin
* The getty's '''-l''' flag invokes a custom login instead of /bin/login; in our case it is set to invoke /usr/sbin/autologin


==== Note ====
==== Note ====
To perform such replacement the following command can be used:
To perform such a replacement on all TTYs, the following command can be used:
{{Cmd|&#35; sed -i 's@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g' /etc/inittab }}
{{Cmd|&#35; sed -i 's@:respawn:/sbin/getty@:respawn:/sbin/getty -n -l /usr/sbin/autologin@g' /etc/inittab }}
* "'''@'''" is used as a delimiter
* "'''@'''" is used as a delimiter
Distro

TTY Autologin

Added agetty, which should be used for non-edge users... and most other use cases as well. Used a bunch of templates. Added a reference and added titles for the other references.

← Older revision Revision as of 22:46, 11 September 2023
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
What follows is one from many different ways to get autologin.
=By using agetty=


== How ==
== How ==
# Writing a wrapper, called autologin, around /bin/login and moving it in /usr/sbin/
Install {{pkg|agetty}}: {{cmd|# apk add agetty}}
# Editing /etc/inittab specifying the use of /usr/sbin/autologin instead of /bin/login
Edit {{path|/etc/inittab}} to use agetty<br>
Example for the virtual terminal tty1:<br>
<code>tty1::respawn:/sbin/agetty --autologin root tty1 linux</code>
 
Example inittab entry for a serial terminal on ttys01:<br>
<code>ttyS0::respawn:/sbin/agetty --autologin root ttyS0 vt100</code>
{{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.}}
 
=By compiling your own autologin program on edge=
What follows is one of many different ways to get autologin on edge.
 
== How ==
# Writing a wrapper, called autologin, around {{path|/bin/login}} and moving it in {{path|/usr/sbin/}}
# Editing {{path|/etc/inittab}} specifying the use of {{path|/usr/sbin/autologin}} instead of {{path|/bin/login}}


== Prerequisites ==
== Prerequisites ==
* A C compiler
* A C compiler
* The '''''musl-dev''''' package which contains the C standard library
* The '''''{{pkg|musl-dev}}''''' package which contains the C standard library


==== Example on how to assolve the prerequisites: ====
==== Example on how to assolve the prerequisites: ====
Line 20: Line 33:
Write into it the following C program.
Write into it the following C program.


{{ cmd|&#35;include <unistd.h>
{{cmd|&#35;include <unistd.h>


int main()  
int main()  
Line 28: Line 41:
}}
}}


The only thing it does is a system call to execute the ''login'' binary (part of busybox) which will be searched in PATH.
The only thing it does is a system call to execute the ''login'' binary (part of busybox) which will be searched in $PATH.


As parameters are passed:
As parameters are passed:
Line 38: Line 51:
{{Cmd|&#35; tcc -o autologin autologin.c }}
{{Cmd|&#35; tcc -o autologin autologin.c }}


Move the binary autologin to /usr/sbin
Move the binary autologin to {{path|/usr/sbin}}
{{Cmd|&#35; mv autologin /usr/sbin/ }}
{{Cmd|&#35; mv autologin /usr/sbin/ }}


Line 49: Line 62:
replace "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''" for each TTY you want to enable autologin.
replace "'':respawn:/sbin/getty''" with "'':respawn:/sbin/getty -n -l /usr/sbin/autologin''" for each TTY you want to enable autologin.
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-n''' flag do not prompt the user for a login name
* The getty's '''-l''' flag invokes a custom login instead of /bin/login; in our case it is set to invoke /usr/sbin/autologin
* The getty's '''-l''' flag invokes a custom login instead of {{path|/bin/login}}; in our case it is set to invoke {{path|/usr/sbin/autologin}}


==== Note ====
==== Note ====
Line 60: Line 73:
It is possible to remove the autologin.c file, the C compiler and the '''musl-dev''' package
It is possible to remove the autologin.c file, the C compiler and the '''musl-dev''' package
{{Cmd|&#35; rm autologin.c  
{{Cmd|&#35; rm autologin.c  
&#35; apk del tcc
&#35; apk del tcc musl-dev}}
&#35; apk del musl-dev}}


== References ==
== References ==
* [https://git.busybox.net/busybox/tree/init/init.c Busybox init source, substantial comments documenting /etc/inittab are at the bottom]
* [http://littlesvr.ca/linux-stuff/articles/autologinconsole/autologincons… Linux-Stuff: Log in automatically to a console when Linux boots]
* [https://wiki.gumstix.com/index.php/AutoLogin AutoLogin - Gumstix User Wiki]
Distro

Talk:TTY Autologin

Disregard previous comment.

← Older revision Revision as of 08:32, 12 September 2023
Line 1: Line 1:
== Isn't this just reinventing the wheel? ==
== Isn't this just reinventing the wheel? ==
Instead of going through the trouble of compiling something, wouldn't it be much easier to <code>apk add {{pkg|agetty}}</code> (from main) and use the {{key|-a}} (<small>{{key|--autologin}}</small>) option? &ndash;zcrayfish ([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]]) 02:13, 11 September 2023 (UTC)
<s>Instead of going through the trouble of compiling something, wouldn't it be much easier to <code>apk add {{pkg|agetty}}</code> (from main) and use the {{key|-a}} (<small>{{key|--autologin}}</small>) option?</s> &ndash;zcrayfish ([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]]) 02:13, 11 September 2023 (UTC)
:Disregard because I edited the article to have both. (the agetty option was needed for the non-edge users in any case) &ndash;[[User:zcrayfish|zcrayfish]] <small>([[User talk:zcrayfish|talk]]•[[Special:Contributions/zcrayfish|contribs]]•[[Special:EmailUser/zcrayfish|send email]])</small> 08:32, 12 September 2023 (UTC)
Distro

TTY Autologin

References: Added getty + agetty documentation

← Older revision Revision as of 08:44, 12 September 2023
Line 79: Line 79:
* [http://littlesvr.ca/linux-stuff/articles/autologinconsole/autologincons… Linux-Stuff: Log in automatically to a console when Linux boots]
* [http://littlesvr.ca/linux-stuff/articles/autologinconsole/autologincons… Linux-Stuff: Log in automatically to a console when Linux boots]
* [https://wiki.gumstix.com/index.php/AutoLogin AutoLogin - Gumstix User Wiki]
* [https://wiki.gumstix.com/index.php/AutoLogin AutoLogin - Gumstix User Wiki]
Distro

Template:Insecure url

Why is mediawiki obsessed with wrapping this template in a <p>?

← Older revision Revision as of 09:32, 12 September 2023
(2 intermediate revisions by the same user not shown)
Line 15: Line 15:
If a reason is given (it should be!), hovering over the open padlock icon will create a small popup displaying the reason.
If a reason is given (it should be!), hovering over the open padlock icon will create a small popup displaying the reason.
</noinclude>
</noinclude>
<includeonly><span style="white-space: nowrap;" title="Insecure URL {{{1}}}">&#128275;</span></includeonly>
<includeonly><small class="nowrap" title="Insecure URL {{{1}}}">&#128275;</small></includeonly>
Distro

TTY Autologin

more template usages & cat to show file content

← Older revision Revision as of 14:51, 13 September 2023
Line 24: Line 24:
==== Example on how to assolve the prerequisites: ====
==== Example on how to assolve the prerequisites: ====
{{Cmd|&#35; apk add --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing tcc
{{Cmd|&#35; apk add --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing tcc
&#35; apk add musl-dev }}
&#35; apk add musl-dev}}


== Writing the autologin.c program ==
== Writing the autologin.c program ==
Line 33: Line 33:
Write into it the following C program.
Write into it the following C program.


{{cmd|&#35;include <unistd.h>
{{cat|autologin.c|&#35;include <unistd.h>


int main()  
int main()  
Line 52: Line 52:


Move the binary autologin to {{path|/usr/sbin}}
Move the binary autologin to {{path|/usr/sbin}}
{{Cmd|&#35; mv autologin /usr/sbin/ }}
{{Cmd|&#35; mv autologin /usr/sbin/}}


== Editing /etc/inittab ==
== Editing /etc/inittab ==


Open /etc/inittab
Open {{path|/etc/inittab}}


{{Cmd|&#35; vi /etc/inittab }}
{{Cmd|&#35; vi /etc/inittab }}
Line 71: Line 71:


== Cleaning up ==
== Cleaning up ==
It is possible to remove the autologin.c file, the C compiler and the '''musl-dev''' package
It is possible to remove the autologin.c file, the C compiler and the {{pkg|musl-dev}} package
{{Cmd|&#35; rm autologin.c  
{{Cmd|&#35; rm autologin.c  
&#35; apk del tcc musl-dev}}
&#35; apk del tcc musl-dev}}
Distro