Skip to content

Multi-user with least privilege: administrators and limited users - #16100

Open
osbase77 wants to merge 81 commits into
omacom:quattrofrom
osbase77:multi-user
Open

osbase77 wants to merge 81 commits into
omacom:quattrofrom
osbase77:multi-user

Conversation

@osbase77

@osbase77 osbase77 commented Oct 20, 2026 •

Copy link
Copy Markdown

Omarchy is built for one person: on an encrypted install, one password opens the disk, logs in, and is root's, and once the disk is unlocked you're logged in without being asked. This PR makes Omarchy a multi-user OS with two tiers of privilege: administrators and limited users. Accounts can be added and removed, each person logs in as themselves, and going back to one account restores the installer's one-password setup. The reason is the principle of least privilege: every account holds the rights its role needs and nothing more.

What it adds

  • omarchy user list [--json]: the login accounts, whether each is an administrator, signed in, and their last login.

  • omarchy user add [name] [--admin], remove [name] [--delete-home], admin [name] on|off. Administrator means wheel membership, the one switch Omarchy already uses: omarchy-provision-owner puts the owner in wheel and writes %wheel ALL=(ALL:ALL) ALL. A machine installed from the ISO grants the owner sudo by name instead, so the first time an administrator is added there, the same %wheel rule is written. Removing or demoting an account deletes the installer's sudo grant for its name and Omarchy's passwordless-sudo grants for its UID, so neither passes to a later account, and taking rights away warns about what it can recognise as still giving root: a sudo rule for every command, and the docker group (sudoless Docker). No account is given the disk password as its own when it's added. You can't remove yourself or the last administrator, remove asks for confirmation first (--yes skips it), your own password gets three tries when the switch between one and several accounts asks for it, and the commands refuse to run as root (they ask for sudo themselves) and tell accounts that aren't administrators so, before sudo asks for a password it would refuse.

  • The switch to several accounts, when the second one is added, splits the one password. The disk password must no longer be your own, and you choose which one changes: a new disk password to share with everyone who starts the computer, or a new password for yourself while the disk keeps the old one. Then:

    • root is locked; administrators use sudo;
    • automatic login is turned off, and the login screen gains a user name field.

    The switch uses the existing omarchy-drive-password command, which records each step of a disk password change and can finish one that was interrupted. Its new --system-stdin mode reads the current and new passwords from stdin, so you aren't asked for passwords you've already typed. The walk to the system disk is its walk: when / sits on an encryption layer whose LUKS device can't be told, the switch either way refuses rather than guess, and so does adding an account.

  • Back to one account restores the installer's setup: your password opens the disk, is root's, and, on an encrypted install, logs you in automatically, as long as it's the disk's only key. If another key opens the disk too, such as one added on purpose or left by another administrator's password change that stopped part way, automatic login stays off, since anyone who knows that key could start the computer into your desktop, and the command says why. The switch back runs before anyone is signed out or removed, and every step of it can be repeated, so a removal stopped there (a closed terminal, a power cut) hasn't signed anyone out, and running the same command again finishes it (while a disk password change you started is still unfinished, the command says to finish it first with omarchy-drive-password).

  • The login screen: when it lists more than one account, a name box above the password box, filled with the last user, with type-ahead completion. There's no list, so it works for any number of accounts, including ones a list wouldn't show. Tab and Shift+Tab move between the boxes, and a last user whose account is gone isn't offered. With one account the screen is exactly as before; an account SDDM doesn't list (HideUsers, its UID range) asks for the name box with Up or Shift+Tab.

  • Limited users: updates, and installs and removals through Omarchy's package commands and pickers (which most Install and Remove entries use), are declined with an explanation that administrator rights are required, before sudo could ask for a password it would refuse. They get no update icon and no first-login update notice, and the machine-wide browser theme color is left to administrators, instead of an administrator-password prompt at first login and at every theme change. omarchy-sudo-allowed answers whether the current session is an administrator's (in wheel). Update › Timezone and Setup › Security › Fido2 tell them they take an administrator. Migrations, which every update can ship and which run in every account, run for a limited account only after an administrator's run, which does their sudo steps (omarchy-migrate records administrators' runs in /var/lib/omarchy/admin-migrations). In the limited account's run, stand-ins for sudo and pkexec run nothing, say what they left, and report success, so its own part applies without a password prompt. A sudo step that names the account itself (its user name, alone or as user:group, or a path in its home) isn't skipped: it fails and says it needs an administrator, so the migration stays pending unless it handles that failure itself; a package helper that finds a package missing (omarchy-pkg-add) fails it the same way. The migration guide says what that asks of new migrations: don't base a step for the user on what a sudo command printed or returned. A few Install and Remove entries go on after a declined step (Remove › Browser › Chrome then runs sudo rm), and they and other admin-only menu entries, such as parts of Setup › Security, still reach sudo's own refusal; they are left for a follow-up.

  • No overlapping updates: updates and administrators' migrations hold one lock for the whole machine (/run/omarchy-update.lock, readable by wheel), so two administrators can't run them at once; the second is told one is already running.

  • Stopping part way fails closed:

    • The switch to several accounts runs before the account is created, so a stop leaves the machine with more protection, never less, and the next run continues where it stopped (while a disk password change you started is still unfinished, the command says to finish it first with omarchy-drive-password).
    • A removal or demotion deletes the grants before the account, or its wheel membership, so a stop never leaves one behind. An add that stops between creating the account and setting its password leaves it without one, so it can't log in until one is set.
    • remove --delete-home doesn't delete a home that holds the note of an unfinished disk password change (.local/state/omarchy/drive-password.state), which finishing that change needs; it says to finish it first, or to remove the account without --delete-home.
    • add and remove ask every question before anything changes, and a password check cryptsetup can't answer stops the command instead of counting as a wrong password.
    • The three commands take one lock only root can hold, and a new account never gets a UID that still owns a home folder kept in /home.
  • The new commands' prompts go through omarchy-i18n.

Includes #15683

This PR carries @AnPod's #15683 unchanged: the update log moves to a per-user path, and the update that installs it still has its log analyzed. Without it, once one account has run an update, the others can't update while /tmp/omarchy-update.log, which belongs to the first, is there. Once #15683 merges and this branch merges the updated quattro, those changes drop out of this diff.

Why: the principle of least privilege

The manual's security chapter opens with "Omarchy takes security extremely seriously", and what follows backs it: full-disk encryption, a firewall, current packages, its own package repository. One thing is missing from that list, and it is a founding principle of Unix security: the principle of least privilege. Every account should hold exactly the rights its role needs, and nothing it does should reach a secret it wasn't given.

On Omarchy today there is only one kind of account, the administrator, with the disk, root and sudo behind one password. Anyone who shares the computer, a partner, a child, a guest, a colleague, gets all of it, because there is nothing else to give them. Omarchy has no way to set up a limited account yet.

This PR adds multi-user and limited-user functionality. A limited user gets a complete Omarchy desktop of their own and can use the applications installed for everyone, but can't reach root from it: sudo refuses them (an account whose rights were just taken away keeps sudo in sessions already open until it signs out, which the command offers to do), this PR never asks an administrator to type a password in a limited user's session, no account is given the disk password as its own when it's added, and taking administrator rights away warns about what it can recognise as still giving root.

The design, and how it differs from Kids mode (#9750)

Kids mode lets a non-admin do admin things when the parent types the parent password, which is root's, into the kid's session: sudo asks for root's password and polkit names root. The kid controls that session, so a fake sudo on their PATH, a shell alias, or a modified shell can capture the password, and it opens root. The review on #9750 notes the modified-shell case and accepts it.

This PR takes the other road. It is least privilege applied to the account model, and these follow from it:

  • This PR never asks an administrator to type their password into another account's session; admin work happens in an administrator's own account. (Some things still ask through polkit, as on stock Omarchy: system tools run directly, such as timedatectl or nmcli, and the Docker TUI.)
  • No shared secret opens root: it is locked while there is more than one account (a removal stopped part way may already have given it the remaining administrator's own password).
  • A limited user is told that administrator rights are required for updates and software changes, instead of a password prompt they can't satisfy.
  • One privilege switch, wheel, which Omarchy's own provisioning and passwordless rules already use. This PR adds no per-user sudo grants.
  • One shared disk password. LUKS is untouched apart from changing that password. Per-user keyslots don't scale (32 at most) and any slot opens the whole disk anyway; once booted, accounts are kept apart by file permissions.

A child's account fits this model as an account that isn't an administrator.

Related PRs

Testing

  • Shell tests, new or extended: user-list (7), user-accounts (83: stateful stand-ins for the account tools, the switch-overs run under script(1) with a queued gum, password checks with real crypt), drive-password (78, including real LUKS1 and LUKS2 volumes for --system-stdin), sudo-allowed, update-available, update-sequence, first-run, pkg-drop, security-fido2, theme-set-browser, sudoers, migrate-scope, update-lock, migrate-notify.

  • ./test/all fails no file on this branch that passes on quattro on the same machine, also with id -nG reporting no wheel.

  • I18N_STRUCTURAL=1 test/shell.d/i18n-test.sh and scripts/i18n-sync.py extract-scan --check pass.

  • Breaking any of the protections makes a test fail (checked by breaking each one).

  • End to end on an edge install (4.0.0.r7083, encrypted, the installer's one password) in a VM:

    • At the start, one account: root has the install password, automatic login is on, and the disk opens with the install password.
    • omarchy user add bob: root locked, automatic login off, and the disk opens only with the new shared password.
    • Restart: the shared password opens the disk and the login screen shows a user name field. bob logs in by typing b (completed to bob), Tab, and his password.
    • bob's first login: no administrator-password prompt and no update notice. Install › Browser › Chrome says "Only an administrator can install software."
    • omarchy user remove bob: root has the owner's password again, automatic login is on, and the disk opens with the owner's password.
    • Restart: the owner's password opens the disk and the desktop comes up without the login screen.
    Login screen Type-ahead
    Login screen Type-ahead
    A non-admin's first login A non-admin installing software
    A non-admin's first login A non-admin installing software

    Adding the second account:

    $ omarchy user add bob
    This will be the second account on this computer, so:
      • the disk password is shared with everyone who starts the computer, so it must differ from your password
      • the login screen asks for a user name, instead of logging you in automatically
      • root is locked; administrators use sudo
    Changing full-disk encryption password for /dev/vda2
    Added bob (administrator: no). Their desktop is set up the first time they log in.
    Give bob the disk password: it unlocks the computer when it starts. Their own password logs them in.
    

    Going back to one:

    $ omarchy user remove bob
    bob is the only other account, so after removing them your password will unlock the disk and root again, and you'll be logged in automatically.
    Changing full-disk encryption password for /dev/vda2
    Your password unlocks the disk and root again, and you'll be logged in automatically.
    Removed bob. Their files stay in /home/bob.
    
  • As bob, with the 9 current migrations that call sudo marked pending again, in the VM: they run in his terminal without a password prompt, each says what it left to an administrator, and all are recorded as done.

  • In the VM, with a second key left on the disk the way an interrupted password change leaves it: removing the last other account goes back to one account but leaves automatic login off, and says why. With that key removed, adding and removing an account turns automatic login back on.

  • In the VM, while the owner holds the update lock: a second administrator is turned away from the lock omarchy update takes and from omarchy-migrate, with "An Omarchy update or migration is already running.", and an account that isn't an administrator can't read the lock and isn't held up by it. The lock is -rw-r----- root wheel.

Built with Claude Code (Claude Opus 5.5 and Fable 5.1), tested in a VM on the current edge image.

🤖 Generated with Claude Code

AnPod and others added 20 commits October 20, 2026 01:48
Two accounts sharing the hard-coded /tmp/omarchy-update.log broke the
second user's update: with fs.protected_regular=1, script(1) cannot open
a transcript another account owns in sticky /tmp, so the update ended
before doing anything (omacom#15679). Log to
${XDG_RUNTIME_DIR:-/tmp}/omarchy-update-$UID.log, the same rule the
update lock already follows, and teach omarchy-update-analyze-logs the
same path.

(cherry picked from commit 3aa2106)
Lists login accounts (UID_MIN..UID_MAX with a login shell), whether each is
an administrator (wheel, as sudo and polkit see it), whether it is signed in,
and its last login. Runs without sudo; --json gives typed fields. One call
each to getent, loginctl and lastlog2 keeps it flat with many accounts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Administrators are the members of wheel. Adding one also writes the
00-omarchy-wheel sudoers drop-in that first-boot provisioning writes, since
an install from the ISO grants sudo to the owner by name and a second
administrator would otherwise get none. Taking rights away removes the
installer's grant for that name too, then checks sudo -l and says so if
another rule still grants full sudo.

Refuses to remove or demote yourself or the last administrator. remove
signs the user out first and, like userdel, keeps the home folder unless
--delete-home. Passwords reach chpasswd on stdin only. Every change writes
one plain line to the journal (journalctl -t omarchy-user).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They run as the user and ask for sudo themselves, like Omarchy's other
commands. Under sudo or in a root shell OMARCHY_PATH is unset, and they
failed with "OMARCHY_PATH: unbound variable"; now they say to run them as
your user, as omarchy-dev-link does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a single-user Omarchy one password unlocks the disk, logs in and is
root's, and the owner is logged in automatically. With a second account
the disk password is typed by everyone who starts the computer, so it
must stop being the first administrator's own password.

omarchy user add, when it creates the second login account, says what
changes, checks the administrator's password, and if it also opens the
disk asks which to change: a new disk password to share (through
omarchy-drive-password) or a new login password (passwd). It then locks
root and turns automatic login off, and reminds the administrator to give
the new user the disk password.

omarchy user remove, when it leaves one login account, asks for the
remaining administrator's password before deleting anything, then sets the
disk (through omarchy-drive-password) and root to it and turns automatic
login back on, as the installer leaves a single-user machine.

Both need a terminal and refuse without one. Unencrypted installs skip the
disk steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--system-stdin is for commands that already have both passwords, like
omarchy user add and remove: it changes the system disk's password,
reading the current one and then the new one from stdin, with no prompts
and no drive choice. Every check applies as when a person types them. An
interrupted earlier change is left for a person to finish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The switch-overs asked for the administrator's password up to three times
(sudo, the check, then omarchy-drive-password). The check now opens sudo
with it, and omarchy-drive-password gets the passwords the command already
has through --system-stdin. A new login password for the administrator is
set with chpasswd instead of passwd. Going back to one account now asks for
two passwords (yours and the shared disk one), adding the second asks for
five (yours, theirs twice, the new shared disk password twice).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The login screen logged in the last user only, so a second account could
not log in from it. With more than one account it now shows a name box
above the password box, in the same style, filled with the last user, who
still just types their password. Up or Shift+Tab goes to the name, Enter
goes back to the password, and a name completes as it is typed from the
accounts SDDM lists. Any name can be typed, so it works for any number of
accounts and for ones the list doesn't show. A single-account machine looks
exactly as before.

The name uses #ffffff, which omarchy-plymouth-set already swaps for the
theme's text color. QtQuick 2.15 for TextInput's textEdited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchy-update stops before its log, lock and password prompt; the bar's
update indicator and first run's update prompt are offered to administrators
only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before sudo or yay asks a password it would then refuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Other accounts were asked for an administrator's password at their first
login and at every theme change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prompts of omarchy user add, remove and admin and of the switch between
one and several accounts come from the English cli catalog through
omarchy-i18n. The catalog check also collects keys from install/helpers,
which those commands source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every step of the switch can be repeated, and the account stays until it is
done, so a removal stopped midway (a closed terminal, a dismissed prompt, a
power cut) is finished by running the same command again. Before, the account
was gone first and nothing could finish the switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDDM remembers the last user after the account is removed; the login screen
then filled the name box with a name that can't log in. The name box offers
the last user only while that account exists, and with one account, that one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
What counts as a login account and as an administrator was defined twice.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…an undecidable disk

- omarchy user add, remove and admin say only an administrator can run them
  before sudo asks for a password it would refuse.
- Your own password is asked three times at most, as sudo does; every wrong
  try counts towards the login lockout, so an endless loop could lock the
  account.
- The walk to the system disk fails when / sits on an encryption layer whose
  LUKS device can't be told, as omarchy-drive-password does, instead of
  treating the disk as unencrypted and leaving the owner's password on it.
- Removing the other account asks for the disk password before anyone is
  signed out, so a switch back that stops there costs no unsaved work; on an
  unencrypted install the announcement promises only what happens.
- Taking administrator rights away notices a full sudo rule whatever its
  tags (SETENV:, NOEXEC:...) or exceptions.
- The password checks of the switch-over take their data as arguments, and
  the two user pickers come from the catalog like the other prompts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The PR appears safe to merge based on the reviewed changes.

Summary

This PR adds administrator and limited-user accounts.

  • Administrators can add, remove, and manage separate login accounts.
  • The login screen asks for a name when several accounts can sign in.
  • Limited accounts keep their own desktop while administrator-only tasks stay with administrators.
  • Administrators' updates and migrations share one machine-wide lock.
  • Each account's update log is saved separately.

No new actionable findings were confirmed. osbase77 deferred reorganizing the update-log test to #15683; Greptile previously accepted that decision.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Account command] --> B[Check administrator rights]
  B --> C[Take account-change lock]
  C --> D{Change}
  D -->|Add second account| E[Separate passwords and disable automatic login]
  E --> F[Create account and set password]
  D -->|Remove last other account| G[Restore single-user passwords]
  G --> H{Disk has only one key?}
  H -->|Yes| I[Enable automatic login]
  H -->|No| J[Keep automatic login off]
  I --> K[Remove grants and account]
  J --> K
  D -->|Change administrator rights| L[Update wheel membership and grants]
Loading

Reviews (26) · Last reviewed commit: "Merge quattro into multi-user" · Reviewed by Greptile

Comment thread bin/omarchy-user-remove Resolved
Comment thread bin/omarchy-user-remove Resolved
Comment thread bin/omarchy-user-remove Resolved
Comment thread bin/omarchy-user-remove Resolved
Comment thread default/sddm/omarchy/Main.qml Resolved
Comment thread bin/omarchy-user-add Resolved
osbase77 and others added 3 commits October 20, 2026 16:08
SDDM lists only the accounts it is told to show (HideUsers, the UID range),
and with one listed account the name box stayed hidden, so an account it
doesn't list couldn't type its name. Up or Shift+Tab from the password box
now shows the name box.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… at a time

- omarchy user add creates the account before the switch to several
  accounts, so a creation that fails leaves the machine as it was, and a
  switch that stops takes the account away again (running it again
  continues where it stopped).
- A new account never gets a UID that still owns a folder under /home, so
  the files of a kept home folder never pass to a later account.
- Removal and demotion drop Omarchy's passwordless-sudo grants, which name
  the account by UID and would pass on with it.
- Removal asks every question (including whether to sign the other account
  out) before it changes anything, so declining leaves the machine as it
  was, still multi-user.
- The three commands take one machine-wide lock, so what one checks still
  holds when it acts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
So typing replaces it instead of appending to it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@osbase77

Copy link
Copy Markdown
Author

All six are addressed in 5732bdf and cb14e54, each with a test that fails without the fix:

  1. New users inherit old files — omarchy user add never hands out a UID that still owns a folder under /home, so a kept home folder's files never pass to a later account.
  2. Recreated users inherit root access — removal and demotion delete Omarchy's passwordless-sudo grants (99-omarchy-*nopasswd-<uid>), which name the account by UID.
  3. Cancellation restores automatic login — removal now asks every question, the sign-out included, before it changes anything; declining leaves the machine as it was, still multi-user.
  4. Account changes race each other — the three commands take one machine-wide lock (/run/lock/omarchy-user.lock) and re-check what they read before it.
  5. Hidden users cannot sign in — with one listed account, Up or Shift+Tab from the password box shows the name box, so an account SDDM doesn't list can type its name.
  6. Failed adds change login settings — the account is created first and the switch runs second; a creation that fails leaves the machine as it was, and a switch that stops takes the account away again and says to run the command again, which continues where it stopped.

Comment thread bin/omarchy-user-add Resolved
Comment thread install/helpers/user-accounts.sh Resolved
osbase77 and others added 2 commits October 20, 2026 16:31
The previous round created the account before the switch to several
accounts, so a stop between the two left a second account able to log in
with root unlocked and automatic login on. The switch comes first again:
a stop leaves one account with more protection, never a second with less,
a creation that fails after the switch says so, and running the command
again continues where it stopped.

The lock file was readable by everyone, so any account could hold the lock
and turn the account commands away. It is root's alone now (0600), held by
a root process for as long as the command runs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
omarchy-drive-password keeps a record of a change that stopped part way and
refuses another until a person finishes it, so after such a stop "run this
again" wasn't true: the add now points at omarchy-drive-password first.
Found on a real encrypted install.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@osbase77

Copy link
Copy Markdown
Author

Both fixed in 20f5c12 (and 1d29ac8, found while testing it on a real encrypted install):

  1. Interrupted adds leave accounts unprotected — right, and the account-first order from the last round caused it. The switch comes first again, so a stop leaves one account with more protection, never a second account with less. A creation that fails after the switch says that the computer is now set up for several accounts and that running the command again adds them; every step of the switch can be repeated, so the next run continues where it stopped. The test for an interrupted add now checks exactly that. One case the real system showed: when omarchy-drive-password itself was interrupted it keeps a record and refuses another change until a person finishes it, so the add now says to run omarchy-drive-password first in that case, rather than "run this again".
  2. Limited users block account changes — the lock file is root's alone now (0600), and the lock is held by a root process for as long as the command runs, so nobody else can open the file, let alone hold the lock. A test checks the mode.

Checked on the install: an add killed in the middle of the switch left one account with the protections that had been applied, and the next run finished the switch and added the account; the lock file is root:root 600, a limited user gets "Permission denied" on it, and a second account command while one is paused at a prompt says "another account change is in progress".

quattro's first-run test reached no omarchy-sudo-allowed, so it never
offered an update; it now runs as an administrator. The update notice
test reached the real checkupdates, and passed only while the machine had
updates pending; it now has one that always finds something, and checks
that other accounts never run it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread test/shell.d/update-log-path-test.sh Resolved
…s, keep tests out of /tmp

The update that installs the per-user path is still run by the old
omarchy-update, which logged to /tmp/omarchy-update.log. Fall back to that
file when the per-user log does not exist, and stay quiet when neither does.

The test's copied analyzer now falls back to the test directory, so it never
writes or deletes a real transcript in /tmp.

(cherry picked from commit 0049516)
osbase77 and others added 3 commits October 23, 2026 02:32
The update lock lived in each account's runtime directory, so with several
administrators two updates could run at once, and omarchy-migrate took no
lock at all. pacman's own lock stops a second package step, but two runs of
the same migration could rebuild one boot image together (mkinitcpio writes
through one fixed temporary file) or add one line twice.

systemd-tmpfiles now creates /run/omarchy-update.lock, readable by wheel
alone, and a migration creates it on existing installs. omarchy-update-lock
takes it instead of the account's own whenever the account can read it,
after checking that the account's own isn't held by an update that started
before the machine-wide lock appeared; such an update's migrations still
run inside it. omarchy-migrate takes the lock for an administrator; other
accounts' migrations change only their own files and lock nothing, as
before. The login notifier now waits while a lock the account takes is
held, then counts what is still pending, so another administrator's update
no longer costs this account its prompt. Tests that run omarchy-migrate
stand in for the lock, so they never touch the machine's real one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quattro removed the migration tests (omacom#16302), among them four this branch
had given an administrator check or update lock stand-in, and the
migration section of passwordless-grant-lifecycle-test.sh along with its
lock stand-in; quattro's side is taken for all five.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As AGENTS.md now asks: the limited-account migration cases join
migrate-wrapper-test.sh, the machine-wide lock cases update-lock-test.sh,
and the first-run update offer gets one administrator case in
first-run-test.sh, which replaces first-run-update-notice-test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lbssousa

Copy link
Copy Markdown

Thanks for this. I run a multi-user Omarchy with an out-of-tree package, omarchy-multiuser, and have already borrowed a few ideas from here (locking root, dropping leftover sudo grants, the update lock). Some things from my side that might help:

  1. Gate limited users' migrations on an administrator's run. The stand-ins report success even if no administrator has run that migration yet, for example when their update failed earlier or packages came from plain pacman -Syu. I record each administrator's run machine-wide and only then run the limited user's part. With your update lock in place, omarchy-migrate could write that record itself.
  2. Removing one of three accounts doesn't rotate the shared disk password, so the removed person can still unlock the disk. Suggesting omarchy-drive-password at that point would close it.
  3. FIDO2 and fingerprints are still single-owner (/etc/fido2/fido2 takes one user, removal tears PAM down for everyone, omarchy-apply-lock follows only the caller's prints). I have per-user versions and can send them as a separate PR on top of this one.

Happy to test this branch on an encrypted machine with several accounts.

osbase77 and others added 2 commits October 24, 2026 13:24
One key file and one set of PAM lines serve the whole machine, and setting
them up installs packages and edits sudo's and polkit's PAM files. An
account that isn't an administrator is now told so before anything is
installed or asked of sudo, instead of being asked for a password sudo then
refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A limited account's run skipped the machine-wide steps and marked a
migration done even when no administrator had run it yet, after an
update that stopped before its migrations, say, so its own part could run
against the system as it was and never again. An administrator's run now
records each migration it runs in /var/lib/omarchy/admin-migrations
(wheel may write, everyone read) before marking it done, and reruns one
the record lacks, such as after a rollback of / that kept /home.
systemd-tmpfiles creates the record, and so does its own migration, which
fails rather than skip it. A limited account's run stops at the first
later pending migration not recorded there, and --pending lists only what
it can run now, so the login notice waits too. Older migrations, and a
machine without the record, run as before.

As lbssousa suggested on omacom#16100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@osbase77

Copy link
Copy Markdown
Author

Thanks, and yes, testing on your machine would help.

  1. Good catch, thank you. A limited account's migrations now wait for an administrator's run: an administrator's run records each migration it runs in /var/lib/omarchy/admin-migrations (writable by wheel, readable by everyone), and a limited account's run stops at the first newer pending migration not recorded there, so the login notice waits too (4339ce9).
  2. We assume that those who share the disk password are of benign intent, and since knowing it can't be exploited without physical access to the computer, removing an account doesn't prompt for a change, sparing the attention and effort it requires. An administrator can change the disk password by hand when needed, with omarchy-drive-password.
  3. Agreed. This PR only keeps an account that isn't an administrator from running FIDO2 setup (1a6ad11). Per-user FIDO2 and fingerprints would be very welcome as a separate PR on top of this one.

test/shell.d/first-run-test.sh: both sides added a case after the update
offer; both are kept, this branch's administrator case first, then
quattro's git identity cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread bin/omarchy-update-lock Resolved
osbase77 and others added 2 commits October 24, 2026 17:33
test/shell.d/i18n-test.sh: this branch collects CLI keys from
install/helpers/ too, and quattro from the setup form's omarchy_form_text
calls; both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
That update runs the omarchy-update from before, holding only its
account's own lock, so once the machine-wide lock appeared another
administrator's update could take it and run alongside the rest of it.
The new omarchy-migrate, which that update runs, now calls
omarchy-update-lock carry as soon as the lock exists, before or after its
migrations: it takes the machine-wide lock for the update and leaves it
with a background process that lets go once the update lets go of its
own. If another account's run holds the lock already, the migrations stop
rather than run alongside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread test/shell.d/pkg-administrator-test.sh Resolved
osbase77 and others added 4 commits October 24, 2026 20:49
When one of that update's migrations created the machine-wide lock,
omarchy-migrate carried the update onto it only after its last migration,
so the migrations after that one could run alongside another
administrator's update. It now carries right after the migration that
creates the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AGENTS.md asks to extend an area's existing test file rather than add a
new one, and pkg-drop-test.sh already tests the package commands. The
checks now use its stubs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quattro folded several test files into shared ones. This branch's checks
follow them:

- migrate-wrapper-test.sh went into migrate-scope-test.sh, and so do this
  branch's limited-account and administrators' record checks, unchanged.
- timezone-test.sh is gone; the timezone menu's check for accounts
  outside wheel goes to sudoers-test.sh, beside the timezone rule.
- browser-policy-sudoers-test.sh and xps13-ptl-firmware-test.sh are
  gone; the administrator stand-ins this branch added there are no longer
  needed (theme-set-browser-test.sh has its own, and hardware-quirks-test.sh
  stands in for omarchy-pkg-add).
- migrate-notify-test.sh keeps this branch's waiting notifier checks
  without the title comparison quattro dropped, and quattro's shared /tmp
  lock check runs the notifier under a timeout, since it now waits rather
  than leaves.
- theme-set-browser-test.sh runs quattro's bare-hex check before this
  branch's check for other accounts, which clears the call log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@theswampdawg

Copy link
Copy Markdown

Sharing archived session-switching findings from a disposable VM experiment on 2026-10-24, for follow-up work around this PR and #14365. Testing used manually provisioned local accounts and native SDDM/PAM; this is not validation of this PR's account or LUKS transition code.

Test stack: encrypted Omarchy 4.0.6-1, SDDM 0.21.0-7, Hyprland 0.56.2-4, UWSM 0.27.1-1, Quickshell 0.3.2.r7.g2b4501a-1, Qt 6.12, QEMU/KVM. We tracked both original session IDs and application PIDs/start times through authenticated A → B → A reuse, with the inactive desktop compositor-locked. The tested lock/logind composition retained local PAM authentication after SDDM reactivation; logind Unlock did not authenticate the Quickshell lock.

Two SDDM details may save investigation time:

  • Existing user reuse and existing greeter reuse are separate paths. Released 0.21.0 has Users.ReuseSession=true, but lacks nerdopolis's upstream greeter-reuse commit dadf4e0. The inspected Arch 0.21.0-7 packaging did not carry that runtime change. Our reproducer was: open SDDM from locked A, return directly to A's still-locked VT without completing greeter login, then request SDDM again. The old greeter remained on VT1; another display attempted VT1 and logged HELPER_TTY_ERROR, leaving an unusable greeter. This corroborates the occupied-VT1 symptom in discussion #11699. Backporting the existing upstream commit prevented the duplicate greeter and preserved the original greeter session/VT. Input after the direct-VT reactivation remained unreliable in this VM, so that backport is not a claim of fully working switching. Normal authenticated round trips passed with it.
  • 0.21.0 user reuse requires a normal sddm session. Its reuse check accepts an inactive online session with service sddm, not an already-running sddm-autologin session. Disabling autologin in configuration does not convert the current session; a normal logout/login is needed before testing reuse. This is useful setup/documentation context for a future switching action.

A separate failure-control result: killing only the native Qt greeter left both user applications and compositor locks intact, but stock Wayland-helper exit handling did not reliably replace/clean up the greeter. Any recovery patch should test a real successful new login too: a first local prototype incorrectly treated normal greeter exit 0 after LoginSucceeded as failure and closed the newly authenticated session, despite passing its class-level tests. That prototype was rolled back. A revised launcher-level test covered real child exits and intentional shutdown.

Native lock acquisition also needs protection against a pre-handoff PAM attempt completing afterward; I left the regression details in this comment on #14911. This experiment ended before the complete failure/graphics matrix passed. Default VirtIO suspend also failed in stock-source controls; real DRM multi-monitor and hardware validation remain open. These notes are for a separately scoped switching follow-up, not a request to add that work to this already substantial account-management PR.

@osbase77

osbase77 commented Nov 4, 2026

Copy link
Copy Markdown
Author

Thanks for these. #16920 has superseded this PR and includes a Switch User action.

@smartsphere

Copy link
Copy Markdown

Real-world case from 4.5.0 (stable) that hits exactly what this PR fixes, in case it's useful for motivation or testing:

A shared family machine: one admin account with the only general sudo grant, plus a second account for a family member added later and placed in wheel — which granted nothing, since the owner's sudo grant is by name (the case this PR writes the %wheel rule for).

After an omarchy update shipped 123 new migrations, the second user got, at every login, the critical "Pending Omarchy Migrations" toast: "Click to run 49 pending migrations." Clicking it opens the presentation terminal; omarchy-migrate applied the 74 user-level migrations fine, then stopped for good at the first one that calls sudo (1791403252 — rewrites /etc/pacman.conf, then omarchy-update-system-pkgs): sudo accepts the password, then refuses the command ("Sorry, user … is not allowed to execute …"), bash -e aborts the run, "Failed!". The count never decreased and the toast returned at every login — the CTA can never succeed for this account.

There's no operator path either: omarchy-sudo-passwordless is strictly self-service (verify_sudo_caller requires SUDO_UID == the requested uid), and running omarchy-migrate as root migrates root's state. The workaround we used was a hand-rolled version of this PR's model: a temporary rule in Omarchy's own 99-omarchy-nopasswd-<uid> format (NOTAFTER deadline, removed at boot and by the omarchy-settings hook), run omarchy-migrate in the user's session, then revoke. Worked cleanly — all 49 applied.

One small interim thought before this lands: the toast's "click to run" promise could probe sudo authorization up front (the way omarchy-sudo-passwordless inspects policy without authenticating) and say "ask an administrator" for accounts that can't run the sudo steps, rather than offering an action that always fails.

Happy to share journal/marker forensics of the failing runs if useful. Thanks for building this — a limited account for a family member is exactly the setup we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants