From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 02:20:34 2021 Received: (at submit) by debbugs.gnu.org; 6 Jul 2021 06:20:34 +0000 Received: from localhost ([127.0.0.1]:47101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0eRe-0003eh-4Y for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:20:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:45586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0eRb-0003eZ-Pz for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0eRb-0002SD-Jz for guix-patches@gnu.org; Tue, 06 Jul 2021 02:20:31 -0400 Received: from mx1.dismail.de ([78.46.223.134]:4899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0eRW-0006iP-GN for guix-patches@gnu.org; Tue, 06 Jul 2021 02:20:31 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id abda4549; Tue, 6 Jul 2021 08:20:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20190914; bh=Rf5zTgybScI0N/lVilxMq 4oZV+5qRQVlL9lk0guT4h4=; b=g1tHUcuRLcRRxF9FWuFyoEIhGx+61y5cCCRZh wyrWmqC/LzyLq6U1M98qPP1wfdEeKpOs+lNWVC4jFFWTHH/VNNVrrdYPajWrO34g RMLnbAZ6LnY04Cui3iYwQciZ1AW07P2llXIr4lglgiVJRK5cBUaprCb0kfz5Z0RA N0AdegCC5Mc2V+RyOciKs/V4SKcIg1roL3/nnCH+CO+V54+A5s65JeBtG5LoCCxn yxMyarQ9+3ukP/hho5U/2b7AzDdDqxLh/FF9u1HbQGk7tXqPVKFadmPLnv+efIbk DwBREbqz3CDQlMCgs8Hq7/i3L5a0k1VEqlLQt1ixrSbEF35Ng== Received: from smtp1.dismail.de ( [10.240.26.11]) by mx1.dismail.de (OpenSMTPD) with ESMTP id e208d87d; Tue, 6 Jul 2021 08:20:20 +0200 (CEST) Received: from smtp1.dismail.de (localhost [127.0.0.1]) by smtp1.dismail.de (OpenSMTPD) with ESMTP id 344575d3; Tue, 6 Jul 2021 08:20:20 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id 8c624c91 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 6 Jul 2021 08:20:18 +0200 (CEST) From: Joshua Branson To: guix-patches@gnu.org Subject: [PATCH] doc: Add auto login to tty guide to the cookbook. Date: Tue, 6 Jul 2021 02:20:04 -0400 Message-Id: <20210706062004.24820-1-jbranso@dismail.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=y Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=78.46.223.134; envelope-from=jbranso@dismail.de; helo=mx1.dismail.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Joshua Branson , leo.prikler@student.tugraz.at X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) From: Joshua Branson * doc/guix-cookbook.texi (System Configuration): Add a brief guide that explains auto login to a TTY. This is a follow up to bug 48974. --- doc/guix-cookbook.texi | 59 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 1cddaa7faf..47f8d60ade 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 to TTY:: Set up auto login via a TTY @end detailmenu @@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced configuration concepts. reference. @menu +* Auto Login to TTY:: Set up auto login via a 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,61 @@ reference. * Setting up NGINX with Lua:: Configuring NGINX web-server to load Lua modules. @end menu +@node Auto Login to TTY +@section Auto Login to TTY + +Guix System currently offers auto login to a tty via @code{mingetty}, +but a newcomer to Guix System may be unfamiliar with setting up auto +login. First, 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 is a secure and +convenient option for you. + +Here is how one might go about setting up auto login to a tty: + +@lisp +(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" "joshua")))) + +(operating-system + (host-name "dobby") + ... + (services + (append + (list (service dhcp-client-service-type)) + %my-base-services))) +@end lisp + +Note that the above code automatically logs the user into @code{tty3}. +Any TTY will work, though perhaps it is best not to use @code{tty1}, +which is reserved for error messages. + +You could also start your graphical environment via your +@code{~/.bash_profile}. Here is an example script to auto start the +sway window manager: + +@example shell +# Honor per-interactive-shell startup file +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi + +if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty3 ]]; then + exec dbus-run-session sway +fi +@end example + +When Guix Home is merged, the above bash script may be replaced by a +@code{home.scm} file. + @node Customizing the Kernel @section Customizing the Kernel -- 2.32.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 02:57:21 2021 Received: (at 49430) by debbugs.gnu.org; 6 Jul 2021 06:57:21 +0000 Received: from localhost ([127.0.0.1]:47134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0f1F-0004Zv-93 for submit@debbugs.gnu.org; Tue, 06 Jul 2021 02:57:21 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:40514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0f1B-0004Zj-Io for 49430@debbugs.gnu.org; Tue, 06 Jul 2021 02:57:19 -0400 Received: from [10.0.0.4] (80-121-26-175.adsl.highway.telekom.at [80.121.26.175]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GJtf16pY8z1LBRx; Tue, 6 Jul 2021 08:57:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4GJtf16pY8z1LBRx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1625554634; bh=36Oe4Z3yoNu4VGEHbQxr7pTCEst6CwhuF1EdAeGKUXQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=oYGwGqNjjjczn5Q/u3/WKv9AWoKVaCHdFIw35DXxPpFW06uYpaf03o0py2usrOHWS teYVS+18+y+sj9UODDV8VQG0EXAm7OqUE87CCoaL2uA0KamilXrZDTFMhwUoelmnqT e9O5laXjwpQXOSuWoe1L9MQFHyHR674DjvnYLmDc= Message-ID: <22087e94e0d1a0c83a5981ff2dbdfddb0b700f01.camel@student.tugraz.at> Subject: Re: [PATCH] doc: Add auto login to tty guide to the cookbook. From: Leo Prikler To: Joshua Branson , 49430@debbugs.gnu.org Date: Tue, 06 Jul 2021 08:56:48 +0200 In-Reply-To: <20210706062004.24820-1-jbranso@dismail.de> References: <20210706062004.24820-1-jbranso@dismail.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49430 Cc: Joshua Branson X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Am Dienstag, den 06.07.2021, 02:20 -0400 schrieb Joshua Branson: > From: Joshua Branson > > * doc/guix-cookbook.texi (System Configuration): Add a brief guide > that > explains auto login to a TTY. This is a follow up to bug 48974. > --- > doc/guix-cookbook.texi | 59 > +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 58 insertions(+), 1 deletion(-) > > diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi > index 1cddaa7faf..47f8d60ade 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 to TTY:: Set up auto login via a TTY This should somehow indicate that it's auto-login to a *particular* TTY, rather than to all TTYs as in the manual. > > @end detailmenu > @@ -1353,6 +1354,7 @@ chapter is to demonstrate some advanced > configuration concepts. > reference. > > @menu > +* Auto Login to TTY:: Set up auto login via a 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,61 @@ reference. > * Setting up NGINX with Lua:: Configuring NGINX web-server to load > Lua modules. > @end menu > > +@node Auto Login to TTY > +@section Auto Login to TTY > + > +Guix System currently offers auto login to a tty via > @code{mingetty}, > +but a newcomer to Guix System may be unfamiliar with setting up auto > +login. First, 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 is a secure > and > +convenient option for you. > + > +Here is how one might go about setting up auto login to a tty: > + > +@lisp > +(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" > "joshua")))) > + > +(operating-system > + (host-name "dobby") > + ... > + (services > + (append > + (list (service dhcp-client-service-type)) > + %my-base-services))) Rather than "joshua@dobby" I think we should pick one of the animals that's widely used in the manual for host-name and alice for the user. > +@end lisp > + > +Note that the above code automatically logs the user into > @code{tty3}. Spell out alice. > +Any TTY will work, though perhaps it is best not to use @code{tty1}, > +which is reserved for error messages. I'm not too sure about the "reserved" bit, because you can absolutely pass TTY1 (the install disk uses it for the ncurses UI, for example). So I'd rather rephrase this as "You can auto-login your user to any TTY, though it's usually advisable to avoid @code{tty1}, as by default it is used to log warnings and errors." > +You could also start your graphical environment via your > +@code{~/.bash_profile}. Here is an example script to auto start the > +sway window manager: > + > +@example shell > +# Honor per-interactive-shell startup file > +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi > + > +if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty3 ]]; then > + exec dbus-run-session sway > +fi > +@end example > + > +When Guix Home is merged, the above bash script may be replaced by a > +@code{home.scm} file. > + This bit is slightly too specific and no longer about logging a user in to a TTY. When Guix Home is merged and there is an appropriate @file{home.scm} to show here, that'll be fine (or even good, if it's one of the first practical examples of Guix Home in the cookbook), but the thing this currently advertises looks like a bit of a hack. I'm somewhat sure, that sway users will intuitively find the `exec dbus-run-session sway` hack on their own -- if not, it ought to be documented as a part of sway, not Guix. WDYT? Leo From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 03:58:23 2021 Received: (at 49430) by debbugs.gnu.org; 6 Jul 2021 07:58:23 +0000 Received: from localhost ([127.0.0.1]:47190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0fyJ-0006DQ-1m for submit@debbugs.gnu.org; Tue, 06 Jul 2021 03:58:23 -0400 Received: from mx1.dismail.de ([78.46.223.134]:49066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0fyG-0006D8-1x for 49430@debbugs.gnu.org; Tue, 06 Jul 2021 03:58:22 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id a632041a; Tue, 6 Jul 2021 09:58:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=20190914; bh=p9qilPGkgJYFVIchFmUtJob+otcxO8oYYy ZAwZKUCrQ=; b=dxynBllGnLsANLW3sSYc4SduBLhQbNnTYxeHK8gY3NK7rYkjLH VPqCaYlaUqqOv7wzlLRo4uAS9egzTfj3YrogmLEsdePm1P07YV16ztqwce1FoLtI eY+I9uSrHaZrNaRWTwAYCJ2zI4o2Ug38hFVZ+pchIhBLQP2B7LTkI+b2i7/bJjmm FCZWYkDwxzHmZOpPtei969EsI6GCh0PSp1hRjUPBjB2SX4pTkveLeI4pCntBDyAF Uhm33Lcrk7FKEPBXr1Qeq6/Mrs27ZPpdquvt7n19Kl9s+bjRhnf7UzFZRGRgaAeb VdskLJK6GGa93POuFHXiVUq8FAmkZrSPjx2Q== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 171dd821; Tue, 6 Jul 2021 09:58:10 +0200 (CEST) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id 9831af49; Tue, 6 Jul 2021 09:58:10 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id 5b665757 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 6 Jul 2021 09:58:08 +0200 (CEST) From: Joshua Branson To: Leo Prikler Subject: Re: bug#49430: [PATCH] doc: Add auto login to tty guide to the cookbook. References: <20210706062004.24820-1-jbranso@dismail.de> <22087e94e0d1a0c83a5981ff2dbdfddb0b700f01.camel@student.tugraz.at> Date: Tue, 06 Jul 2021 03:58:06 -0400 In-Reply-To: <22087e94e0d1a0c83a5981ff2dbdfddb0b700f01.camel@student.tugraz.at> (Leo Prikler's message of "Tue, 06 Jul 2021 08:56:48 +0200") Message-ID: <87wnq327sh.fsf_-_@dismail.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49430 Cc: Joshua Branson , 49430@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) I'll do some edits and update the patch. Thanks for the suggestions! -- Joshua Branson (joshuaBPMan in #guix) Sent from Emacs and Gnus https://gnucode.me https://video.hardlimit.com/accounts/joshua_branson/video-channels https://propernaming.org "You can have whatever you want, as long as you help enough other people get what they want." - Zig Ziglar From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 04:09:20 2021 Received: (at 49430) by debbugs.gnu.org; 6 Jul 2021 08:09:21 +0000 Received: from localhost ([127.0.0.1]:47205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0g8u-0006Vc-K9 for submit@debbugs.gnu.org; Tue, 06 Jul 2021 04:09:20 -0400 Received: from mx1.dismail.de ([78.46.223.134]:43979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0g8s-0006VN-6V for 49430@debbugs.gnu.org; Tue, 06 Jul 2021 04:09:19 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 97729ec3; Tue, 6 Jul 2021 10:09:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20190914; bh=O1Uq58QW0lWYYgA/m7Q2c /G7z4qQbrbnqhXriXGdn3w=; b=TnR+xDpXbPkQWSl3qQlJOgjmKoRLy8tqrLTAy 3aPL17UlOWNiZA5C57sHJ8cuPU82oVTgJJm5h16hj8QcwqEZ1gdlzajemqOJuuwP 7tPrbgBnM5950e9+Ul96fmpcTNZZ/C+AoKACTflQknQT4sw//KDoD9rBMAhgKzcS BoE0VRR/C98Q0eIfg9ncc+5Ow5ucb2JVaiQO14ZWcdcJp8qVvjZBgWXDCbfduVb9 AH4GUnA1bzGWFOhBBGt1hJlkZ0X5+wND7XRcFszTGD9GN4u94OeFfOaco7F80gu7 wMAitZ7ExLQI6XCPlin/n1S7zR6U17j8ZesMpOFXmDLuBJD/g== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 95d88311; Tue, 6 Jul 2021 10:09:10 +0200 (CEST) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id f7f05e47; Tue, 6 Jul 2021 10:09:10 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id d153477b (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 6 Jul 2021 10:09:09 +0200 (CEST) From: Joshua Branson To: 49430@debbugs.gnu.org Subject: [PATCH] doc: Add auto login to tty guide to the cookbook. Date: Tue, 6 Jul 2021 04:08:56 -0400 Message-Id: <20210706080856.22614-1-jbranso@dismail.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=y Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49430 Cc: Joshua Branson , leo.prikler@student.tugraz.at X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) From: Joshua Branson * doc/guix-cookbook.texi (System Configuration): Add a brief guide that explains auto login to a TTY. This is a follow up to bug 48974. --- doc/guix-cookbook.texi | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 1cddaa7faf..85489e1a93 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,47 @@ 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 + +Guix System currently offers auto login to a tty via @code{mingetty}, +but a newcomer to Guix System may be unfamiliar with setting up auto +login. First, 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 is a secure and +convenient option for you. + +Here is how one might go about setting up auto login to a tty: + +@lisp +(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 (service dhcp-client-service-type)) + %my-base-services))) +@end lisp + +Note that the above code will automatically login the user @code{alice} +into @code{tty3}. You can auto-login your user to any TTY, though it's +usually advisable to avoid @code{tty1}, as by default it is used to log +warnings and errors. + + @node Customizing the Kernel @section Customizing the Kernel -- 2.32.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 04:59:10 2021 Received: (at 49430) by debbugs.gnu.org; 6 Jul 2021 08:59:10 +0000 Received: from localhost ([127.0.0.1]:47303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0gv8-0007jh-4C for submit@debbugs.gnu.org; Tue, 06 Jul 2021 04:59:10 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:38807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0gv5-0007jY-P6 for 49430@debbugs.gnu.org; Tue, 06 Jul 2021 04:59:09 -0400 Received: from [10.0.0.4] (80-121-26-175.adsl.highway.telekom.at [80.121.26.175]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GJxLb5cR2z1LWnt; Tue, 6 Jul 2021 10:59:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4GJxLb5cR2z1LWnt DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1625561944; bh=p9dSPQqUsb+chpAxvgiGsd6KoIRG9PCjT2AKpusEG+A=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=SmbH1qRvr9ZO7FieS4v4XcmUfWJ9DvnMBVukriJocTlQBigVn3hJD7juVMyzTUpBZ Qy5LjI8exBc244k4GYMPpypsndxtdKDx/ZB2+l7Z/G5OVzPq/JVDi8AiOKF+KIyIDK hgYgM/LNGrA8urrD7i7qX7HKQ1OvnnlZ/I6bxSX0= Message-ID: Subject: Re: [PATCH] doc: Add auto login to tty guide to the cookbook. From: Leo Prikler To: Joshua Branson , 49430@debbugs.gnu.org Date: Tue, 06 Jul 2021 10:58:43 +0200 In-Reply-To: <20210706080856.22614-1-jbranso@dismail.de> References: <20210706080856.22614-1-jbranso@dismail.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49430 Cc: Joshua Branson X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, this looks a bit better, but a few things remain, that irk me. Am Dienstag, den 06.07.2021, 04:08 -0400 schrieb Joshua Branson: > From: Joshua Branson > > * doc/guix-cookbook.texi (System Configuration): Add a brief guide > explaining mingetty auto-login. I think the commit message is better written as above instead of what you had. > --- > doc/guix-cookbook.texi | 45 > +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > > diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi > index 1cddaa7faf..85489e1a93 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 I'm not a fan of this breaking the columns, but perhaps it's necessary. > * 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,47 @@ 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 > + > +Guix System currently offers auto login to a tty via > @code{mingetty}, > +but a newcomer to Guix System may be unfamiliar with setting up auto Note, that mingetty is not the only service offering auto-login. Basically all terminals and DMs have one. Also "a newcomer" → "newcomers" may be more appropriate in that it doesn't single anyone out, though in my personal opinion "newcomer" has some "only grade schoolers play on easy modo" vibes attached to it, particularly within a manual/cookbook. Perhaps to soften this, you should open up stating "While the Guix manual explains how to login a user to *all* TTYs, some might prefer a situation, in which one user is logged in to one TTY with the other TTYs either configured to login different users or no one at all." > +login. First, 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 is a secure > and > +convenient option for you. > + > +Here is how one might go about setting up auto login to a tty: > + > +@lisp > +(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")))) I'd inline this definition below in services > +(operating-system > + (host-name "antelope") > + ... > + (services > + (append > + (list (service dhcp-client-service-type)) Replace this by a comment ";; additional services you might want, e.g" followed by the commented service list. > + %my-base-services))) > +@end lisp Follow up with how one can compose auto-login-to-tty to login multiple users to multiple TTYs (no full system config needed here, just the mention of compose). Finally, though this is very personal, I'd put the note of caution from before here at the end, because now the reader has a complete understanding of what it is, that they are achieving. Putting the warning in the front might scare them away into not trying – which would be a security win for sure – but it could also happen, that they just skip over the warning and copypasta the code. Having everything together at the bottom is therefore preferable in my personal opinion, though again, that's very personal and others might disagree here. > +Note that the above code will automatically login the user > @code{alice} > +into @code{tty3}. You can auto-login your user to any TTY, though > it's > +usually advisable to avoid @code{tty1}, as by default it is used to > log > +warnings and errors. The explanation that alice is logged into tty3 is probably apparent from the procedure call, so putting the explanation of avoiding TTY1 among the caveats above has priority over when to explain, that alice is logged in to tty3. Still, you might want to split this up, so that the former goes in front of the explanation on how to login multiple users and the latter to the caveats. Regards, Leo From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 06 21:39:46 2021 Received: (at 49430) by debbugs.gnu.org; 7 Jul 2021 01:39:46 +0000 Received: from localhost ([127.0.0.1]:50449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0wXR-0000xD-Hm for submit@debbugs.gnu.org; Tue, 06 Jul 2021 21:39:45 -0400 Received: from mx1.dismail.de ([78.46.223.134]:17196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0wXP-0000wz-7O for 49430@debbugs.gnu.org; Tue, 06 Jul 2021 21:39:44 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id aaf61276; Wed, 7 Jul 2021 03:39:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20190914; bh=TC4CwFYIMF3vO2MCcKluP b7o8KCAYdlLvhQDokFMvxY=; b=hc0YIOhrFzJgz5yln3y0oSKNPMgvKEGtJson1 fvvp4tvhn282ZZU54U/2/t0hR0cVtNp0g0VPqWpwtJZuFpUbboMOKoYFXJlwCqEY tVubtUKV1m3zMMBXO136VldDbYaI2bo5iCfkpAvweXsVjUq5kE6INsCRNouaSAg3 tQGdcJRybgNf18s01a3YgiSenHs7IrV6KGf7bJyAGoQuE5oqnJN+tRh1pw6GFHhD 8HUZ/6KOwFcU5QYbWXPT0Hq/xfQVOc/H3qDE/kxu5dAR2vC59cQNzWOzyXjTaLnY NZXyjdsQRj1+zBwMkQwgNqnPgaweamiuRoNsa1/2ns50ppBkQ== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 693ed2da; Wed, 7 Jul 2021 03:39:35 +0200 (CEST) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id 54502962; Wed, 7 Jul 2021 03:39:35 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id b014bb00 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 7 Jul 2021 03:39:34 +0200 (CEST) From: Joshua Branson To: 49430@debbugs.gnu.org Subject: [PATCH] doc: Add auto login a user to a specific tty guide to the cookbook. Date: Tue, 6 Jul 2021 21:39:09 -0400 Message-Id: <20210707013909.13774-1-jbranso@dismail.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=y Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49430 Cc: Joshua Branson , leo.prikler@student.tugraz.at X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) From: Joshua Branson * 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 05:29:20 2021 Received: (at 49430-done) by debbugs.gnu.org; 7 Jul 2021 09:29:20 +0000 Received: from localhost ([127.0.0.1]:50903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m13rr-0004Vf-Gx for submit@debbugs.gnu.org; Wed, 07 Jul 2021 05:29:19 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:32615) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m13ro-0004VR-IB for 49430-done@debbugs.gnu.org; Wed, 07 Jul 2021 05:29:18 -0400 Received: from nijino.local (80-121-26-175.adsl.highway.telekom.at [80.121.26.175]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GKYyx3DpGz1LX54; Wed, 7 Jul 2021 11:29:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4GKYyx3DpGz1LX54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1625650153; bh=yzE8T3cgYTuj7aVZ71crFfVmrG/wnvNs80sO3iWmimg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nfUSHeb8AtDt100GiPqPgETRs7F+ZyNlhpsqtQD5IerLzBNbl3gCF6PKTglLGzZrb OTdHxDTag2sWnXLW+XiT7QYuIYdUsNPRuZXJrloUt7WkFX7agUt6CYMzW7ozGvlpdi 1U/Amgj8KWICGX+EhnaHnkIfQqhNO672ue+7QLPM= Message-ID: <29902d02d007a22b66037308e1f1a89fc6352918.camel@student.tugraz.at> Subject: Re: [PATCH] doc: Add auto login a user to a specific tty guide to the cookbook. From: Leo Prikler To: Joshua Branson , 49430-done@debbugs.gnu.org Date: Wed, 07 Jul 2021 11:29:12 +0200 In-Reply-To: <20210707013909.13774-1-jbranso@dismail.de> References: <20210707013909.13774-1-jbranso@dismail.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49430-done Cc: Joshua Branson X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) I've pushed your code with some slight cosmetic changes, which I'll list below to master. - I changed the title of the section to easier fit into a menu. - I changed the example to mimic the one given in the manual - I rephrased the bit about encrypted root. Note, that applying the patch was a bit of a pain, as your send-email setup appears to set the following: Content-Type: text/plain; charset=y Please use UTF-8 in the future ;P Also, I'll probably receive a mail in a few hours stating that < jbranso@gnucode.me> can not be reached. Does this mail really satisfy the conditions one would typically have for having it in AUTHORS? Regards, Leo Am Dienstag, den 06.07.2021, 21:39 -0400 schrieb Joshua Branson: > From: Joshua Branson > > * 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 From unknown Sun Jun 22 00:27:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 04 Aug 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator