Mac: automatic login via launchctl asuser, checked password

bad2426 failed silently: over SSH `sysadminctl -autologin set` can't reach
the loginwindow session agent and fails with SACSetAutoLoginPassword
error:22 (rc 0), leaving autoLoginUser set without /etc/kcpassword. Per
gulasz101/homelab-2nd#178 (measured 2026-11-09), run it inside the console
user's session with `launchctl asuser <uid>`, password on stdin. It accepts
wrong passwords, so check the vault password with `dscl -authonly` first
(as brunerd's setAutoLogin.sh does). Idempotency now checks autoLoginUser
and /etc/kcpassword instead of the status text, which never matched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-11 07:39:31 -07:00
1 parent bad2426896
commit 6632729892
2 files changed
+51 -14

No files matched your search

+3 -1
View File
@@ -43,7 +43,9 @@ Manages cogitator-02, an Apple Silicon Mac on the tailnet (`mac.yml`,
- **Automatic login** (tag `autologin`): phil is logged in automatically after
a reboot, so everything that needs a login session (dashboard, Podman VM,
BlueBubbles, Beeper) comes back after a power cut. Uses phil's password from
the vault; redeploy after changing it.
the vault; after changing it, `sudo rm /etc/kcpassword` on the Mac and
redeploy. Setting it needs phil logged in at the console: `sysadminctl`
only works inside that session (`launchctl asuser`).
Ansible logs in as `phil`. sudo needs phil's password, which is in the vault
as `vault_cogitator02.become_password`; only tasks with `become: true` use it.