Next: , Up: System Configuration   [Contents][Index]


3.1 Auto-Login to a Specific TTY

While the Guix manual explains auto-login one user to all TTYs (see auto-login to TTY in 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 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:

(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-services
  (modify-services %base-services
    ;; …
    (mingetty-service-type config =>
                           (auto-login-to-tty
                            config "tty3" "alice"))))

(operating-system
  ;; …
  (services %my-services))

One could also compose (see Higher-Order Functions in The Guile Reference Manual) 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. However, if you have an encrypted root partition, and thus already need to enter a passphrase when the system boots, auto-login might be a convenient option.