]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add FAQ entry on how to add regular users to image 2322/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 24 Jan 2024 07:52:55 +0000 (08:52 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 24 Jan 2024 09:06:04 +0000 (10:06 +0100)
Fixes #2320

mkosi/resources/mkosi.md

index fa05c87b10a8bdd1c924f75aa03571616de3fbed..bdb914008adf66e77d890c1a5f8ddef1abca740a 100644 (file)
@@ -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