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 be pasted with just sops under user.alice.password-hash.

  2. Validate in 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 by the old session password. At the next session opened with the password, DNF removes it and GNOME recreates it empty: no prompt, the old password no longer opens anything.

  • Applications: credentials to re-enter once (Nextcloud, online accounts, Chromium).
  • Login with YubiKey, or keyring still active: removal deferred to a later session.
  • Keyring without a password (YubiKey fix, accessibility): kept.

To keep a keyring protected by a clean password:

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

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;