Skip to content

Manage users

This page covers the POSIX account declared in etc/config.yaml : declaration, attachment to hosts, password, SSH access, deactivation.

Users are declared once in etc/config.yaml, then attached to the hosts where they must log in. The same account can exist on several machines.

etc/config.yaml
users:
alice:
uid: 1000
name: "Alice Martin"
email: "alice@domain.tld"
profile: "advanced"
groups: ["global", "idm-devs"]
FieldRole
(key)Account login (e.g. alice)
uidStable numeric identifier
nameDisplay name
emailAddress (also used for SSO identity)
profileUser profile (environment)
groupsGroups (network access and services)

The HCS deployment also creates a Kanidm account for them, without credentials.

Under a host, users lists the existing logins allowed to connect to it:

etc/config.yaml
hosts:
poste-alice:
profile: "desktop"
users: ["alice"]

Any change to etc/config.yaml follows the same cycle:

  1. Describe the change

    Create or modify the user and their machines in etc/config.yaml.

  2. Regenerate and clean the code

    Fenêtre de terminal
    just clean # generate + fix + format
  3. Validate in git

    Fenêtre de terminal
    just commit "user(new): alice"
  4. Deploy

    Fenêtre de terminal
    just apply @user-alice,hcs # alice's machines + Kanidm account
  1. Set the hash

    Fenêtre de terminal
    just passwd alice

    The user can enter their own password. Remotely, they send their hash (mkpasswd -m sha-512), to paste with just sops under user.alice.password-hash.

  2. Commit to git

    Fenêtre de terminal
    just commit "chore(user): alice password"
  3. Deploy

    Fenêtre de terminal
    just apply @user-alice,hcs

SSH access is key-only and entirely declarative, across the whole fleet :

  • Passwords and interactive keyboard are disabled.
  • Declare public keys in usr/users/<login>/authorized_keys.
  • The file applies to all hosts of the account.
  • An account with no declared key can open a local session, outside SSH.
Fenêtre de terminal
# usr/users/<login>/authorized_keys : one key per line, `#` starts a comment
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA… alice@portable

A private key never goes anywhere near the repository or sops : the infra key, present on every host, would make it readable by any root account of the cluster. It lives in the user’s Vaultwarden vault, encrypted end to end.

On the selected workstations, rbw acts as the SSH agent and reads the keys from the vault :

# usr/users/<login>/default.nix (advanced, admin, nix-admin profiles…)
darkone.home.advanced.enableVaultwardenSsh = true;
  • The user stores their key in the vault (Use my SSH key).
  • Its public key then goes into authorized_keys.
  • Locks after 12 h of inactivity : programs.rbw.settings.lock_timeout (seconds).

The groups in config.yaml are logical: they do not become Unix groups, so DenyGroups would see nothing. DNF translates them into DenyUsers, on a per-host basis:

# Default: guest accounts keep their local session, no SSH.
darkone.user.build.sshDeniedGroups = [ "guests" ];
  • On one host: remove the login from the host’s users list.
  • Everywhere: remove the entry under users:.
  • Service access: removing the user from groups cuts SSO access.

In all cases, then apply the just clean → just commit → just apply cycle on the affected hosts.

The private key is born inside the YubiKey (FIDO2) and never leaves it : nothing to store in the vault. Every connection requires touching the key.

Fenêtre de terminal
ssh-keygen -t ed25519-sk -O resident -O verify-required # creation, once
# On another workstation: retrieve the handle under the default name
cd ~/.ssh && ssh-keygen -K && mv id_ed25519_sk_rk id_ed25519_sk
  • The public key (sk-ssh-ed25519@openssh.com …) joins authorized_keys.
  • rbw does not manage these keys : ssh reads them from ~/.ssh.

The login keyring remains encrypted with the old session password. At the next session opened with the password, DNF moves it to ~/.local/share/keyrings.sealed/ and GNOME recreates it empty : no prompt.

  • Applications: credentials to re-enter once (Nextcloud, online accounts, Chromium).
  • Element Desktop: session lost.
  • Unlocking by YubiKey, or keyring still active: move postponed to a later session.
  • Passwordless keyring: kept.

To keep a keyring protected by its own password :

# usr/users/<login>/default.nix
darkone.home.gnome.keepKeyring = true;

Default for non-technical profiles on an encrypted host (LUKS) : the login keyring opens without a prompt, including when the session is opened by YubiKey.

  • Secrets: in plain text in ~/.local/share/keyrings, protected at rest by LUKS alone.
  • Restic backups: copied as is, into a repository encrypted by restic.
  • Keyring already encrypted: moved to ~/.local/share/keyrings.sealed/ at deployment.
  • Consequences: credentials to re-enter once, Element Desktop session lost.
  • Session opened during deployment: move at the next boot.
  • Session password: never passed to the keyring, which therefore does not re-encrypt itself.

To enable it (technical profile) or disable it :

# usr/users/<login>/default.nix
darkone.home.gnome.passwordlessKeyring = true; # ou false

keepKeyring = true also disables it.

Element Desktop shows Unable to restore session, with Remove this device and Refresh. Its decryption key was in the moved keyring : Refresh cannot help. The machine log confirms it :

Fenêtre de terminal
sudo journalctl _UID=$(id -u <login>) | grep 'Failed to decrypt secret'

Repair with the copy in ~/.local/share/keyrings.sealed/ and the old password :

  1. Put the copy back, session closed and under the user’s account :

    Fenêtre de terminal
    cd ~/.local/share/keyrings
    mv login.keyring ../keyrings.sealed/login.keyring.plain
    cp ../keyrings.sealed/login.keyring.<date> login.keyring
  2. Open the session, without rebooting: the old password unlocks the keyring, Element starts again.

  3. Clear the password: Passwords and Keys, login keyring, Change Password, new empty password.

  4. Check: head -c 9 ~/.local/share/keyrings/login.keyring shows [keyring].

Without a copy or without the old password, Remove this device remains the only way out :

  • Reconnection: verify the new device from another one, or with the recovery key.
  • History: messages missing from the key backup remain unreadable.
  • Old device: still listed on the server, to be removed with matrix-admin.

To lose nothing, clear the password (step 3) before deployment, session open : a plain-text keyring is not moved.

An application has replaced a file managed by Home Manager (mimeapps.list, settings…). At the next activation, it becomes <file>.bkp and the declared version takes its place back.

  • Only one backup per file: the previous one is overwritten.
  • Change to keep: declare it in usr/users/<login>/default.nix.

By default, the GDM login screen asks you to type your username. To pick your account from a list, on a shared machine for example :

# usr/machines/<hôte>/configuration.nix
darkone.graphic.gnome.enableGdmSelector = true;