Skip to content

Commit eaaffd9

Browse files
WhyNotHugokennylevinsen
authored andcommitted
Clarify setup instructions without PAM
- Mention that using a TCB-like setup doesn't require SUID. - Recommend using SGID instead of SUID.
1 parent 56c5025 commit eaaffd9

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,24 @@ Run these commands:
4242
ninja -C build
4343
sudo ninja -C build install
4444

45-
On systems without PAM, you need to suid the swaylock binary:
45+
##### Without PAM
46+
47+
On systems without PAM, swaylock uses `shadow.h`.
48+
49+
Systems which rely on a tcb-like setup (either via musl's native support or via
50+
glibc+[tcb]), require no further action.
51+
52+
[tcb]: https://www.openwall.com/tcb/
53+
54+
For most other systems, where passwords for all users are stored in `/etc/shadow`,
55+
swaylock needs to be installed suid:
4656

4757
sudo chmod a+s /usr/local/bin/swaylock
4858

59+
Optionally, on systems where the file `/etc/shadow` is owned by the `shadow`
60+
group, the binary can be made sgid instead:
61+
62+
sudo chgrp shadow /usr/local/bin/swaylock
63+
sudo chmod g+s /usr/local/bin/swaylock
64+
4965
Swaylock will drop root permissions shortly after startup.

meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ if libpam.found()
110110
sources += ['pam.c']
111111
dependencies += [libpam]
112112
else
113-
warning('The swaylock binary must be setuid when compiled without libpam')
113+
warning('The swaylock binary often needs to be setuid when compiled without libpam')
114114
warning('You must do this manually post-install: chmod a+s /path/to/swaylock')
115+
warning('See the "Without PAM" section of the README for details.')
115116
sources += ['shadow.c']
116117
dependencies += [crypt]
117118
endif

0 commit comments

Comments
 (0)