Commit 0fc6697
fix(manage_zsh): abort shell change if zsh package install fails
Previously, /etc/default/useradd, /etc/adduser.conf, and /etc/passwd
were all updated to use /bin/zsh before pkg_install was called. If the
install failed (e.g. package unavailable, no network), /bin/zsh would
be set as the shell for root and all users even though it was never
installed and not listed in /etc/shells.
pam_shells blocks all authentication (including SSH public key auth)
for any user whose shell is not present in /etc/shells, effectively
locking every user out of the system with no obvious recovery path.
Fix: call pkg_install first and abort with an error message if it fails,
so shell config files and /etc/passwd are only modified after a
successful install.1 parent 68f4b29 commit 0fc6697
1 file changed
+9
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 19 | | |
23 | 20 | | |
24 | | - | |
25 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
0 commit comments