From ab1f256c18c69095bb7958c7cbd5a0f91da00f26 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 24 Jan 2024 08:52:55 +0100 Subject: [PATCH] Add FAQ entry on how to add regular users to image Fixes #2320 --- mkosi/resources/mkosi.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index fa05c87b1..bdb914008 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -2316,6 +2316,18 @@ Note that the minimum required Python version is 3.9. `/etc/tmpfiles.d/static-nodes-permissions.conf` and change the mode of `/dev/kvm` from `0660` to `0666`. +- How do I add a regular user to an image? + + You can use the following snippet in a post-installation script: + + ```sh + useradd --create-home --user-group $USER --password "$(openssl passwd -stdin -6 <$USER_PASSWORD_FILE)" + ``` + + Note that from systemd v256 onwards, if enabled, + `systemd-homed-firstboot.service` will prompt to create a regular user + on first boot if there are no regular users. + # REFERENCES * [Primary mkosi git repository on GitHub](https://github.com/systemd/mkosi/) * [mkosi — A Tool for Generating OS Images](https://0pointer.net/blog/mkosi-a-tool-for-generating-os-images.html) introductory blog post by Lennart Poettering -- 2.47.2