Package: guix-patches;
Reported by: Joshua Branson <jbranso <at> dismail.de>
Date: Tue, 6 Jul 2021 06:21:02 UTC
Severity: normal
Tags: patch
Done: Leo Prikler <leo.prikler <at> student.tugraz.at>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Joshua Branson <jbranso <at> dismail.de> To: 49430 <at> debbugs.gnu.org Cc: Joshua Branson <jbranso <at> gnucode.me>, leo.prikler <at> student.tugraz.at Subject: [bug#49430] [PATCH] doc: Add auto login a user to a specific tty guide to the cookbook. Date: Tue, 6 Jul 2021 21:39:09 -0400
From: Joshua Branson <jbranso <at> gnucode.me> * doc/guix-cookbook.texi (System Configuration): Add a brief guide that explains auto login a user to one TTY. This is a follow up to bug 48974. * doc/guix.texi (System Services): Add an texinfo anchor, so that the cookbook entry "Auto Login a User to a Specific TTY" can refer back to the precise point that the GNU Guix Reference manual. Also add a reference to the cookbook that shows how to auto login a specific user to one TTY. --- doc/guix-cookbook.texi | 58 +++++++++++++++++++++++++++++++++++++++++- doc/guix.texi | 13 ++++++---- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 1cddaa7faf..a9c3ef6407 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -17,6 +17,7 @@ Copyright @copyright{} 2020 Marcin Karpezo@* Copyright @copyright{} 2020 Brice Waegeneire@* Copyright @copyright{} 2020 André Batista@* Copyright @copyright{} 2020 Christopher Lemmer Webber +Copyright @copyright{} 2021 Joshua Branson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -85,7 +86,7 @@ Packaging System Configuration -* Customizing the Kernel:: Creating and using a custom Linux kernel +* Auto Login a User to a Specific TTY:: Automatically Login a User to a Specific TTY @end detailmenu @@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced configuration concepts. reference. @menu +* Auto Login a User to a Specific TTY:: Automatically Login a User to a Specific TTY * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System. * Guix System Image API:: Customizing images to target specific platforms. * Connecting to Wireguard VPN:: Connecting to a Wireguard VPN. @@ -1363,6 +1365,60 @@ reference. * Setting up NGINX with Lua:: Configuring NGINX web-server to load Lua modules. @end menu +@node Auto Login a User to a Specific TTY +@section Auto Login a User to a Specific TTY + +While the Guix manual explains auto-login one user to @emph{all} TTYs ( +@pxref{auto-login to TTY,,, guix, GNU Guix Reference Manual}), some +might prefer a situation, in which one user is logged into one TTY with +the other TTYs either configured to login different users or no one at +all. Note that one can auto-login one user to any TTY, but it is +usually advisable to avoid @code{tty1}, which, by default, is used to +log warnings and errors. + +Here is how one might set up auto login for one user to one tty: + +@lisp +(use-modules (gnu) (guix)) +(use-service-modules avahi networking xorg) + +(define (auto-login-to-tty config tty user) + (if (string=? tty (mingetty-configuration-tty config)) + (mingetty-configuration + (inherit config) + (auto-login user)) + config)) + +(define %my-base-services + (modify-services %base-services + (mingetty-service-type config => + (auto-login-to-tty + config "tty3" "alice")))) + +(operating-system + (host-name "antelope") + ... + (services + (append + (list + ;; additional services you might want, e.g + ;; (service avahi-service-type) + ;; (service gdm-service-type) + (service dhcp-client-service-type)) + %my-base-services))) +@end lisp + +One could also @code{compose} (@pxref{Higher-Order Functions,,, guile, +The Guile Reference Manual}) @code{auto-login-to-tty} to login multiple +users to multiple ttys. + +Finally, here is a note of caution. Setting up auto login to a TTY, +means that anyone can turn on your computer and run commands as your +regular user. If you have encrypted your @code{/} partition, and thus +need to enter in a passphrase at boot, then perhaps auto login to a TTY +is a secure and convenient option for you. + + @node Customizing the Kernel @section Customizing the Kernel diff --git a/doc/guix.texi b/doc/guix.texi index 1086d3220b..0410225196 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13542,10 +13542,11 @@ Occasionally, instead of using the base services as is, you will want to customize them. To do this, use @code{modify-services} (@pxref{Service Reference, @code{modify-services}}) to modify the list. -For example, suppose you want to modify @code{guix-daemon} and Mingetty -(the console log-in) in the @code{%base-services} list (@pxref{Base -Services, @code{%base-services}}). To do that, you can write the -following in your operating system declaration: +@anchor{auto-login to TTY} For example, suppose you want to modify +@code{guix-daemon} and Mingetty (the console log-in) in the +@code{%base-services} list (@pxref{Base Services, +@code{%base-services}}). To do that, you can write the following in +your operating system declaration: @lisp (define %my-services @@ -13571,7 +13572,9 @@ following in your operating system declaration: This changes the configuration---i.e., the service parameters---of the @code{guix-service-type} instance, and that of all the -@code{mingetty-service-type} instances in the @code{%base-services} list. +@code{mingetty-service-type} instances in the @code{%base-services} list +(@pxref{Auto Login a User to a Specific TTY, see the cookbook for how to +auto-login one user to a specific TTY,, guix-cookbook, GNU Guix Cookbook})). Observe how this is accomplished: first, we arrange for the original configuration to be bound to the identifier @code{config} in the @var{body}, and then we write the @var{body} so that it evaluates to the -- 2.32.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.