mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00:00
Updated Running Sway without systemd (markdown)
parent
112916147b
commit
3486ea9b52
33
Running-Sway-with-seatd,-elogind-or-systemd‐logind.md
Normal file
33
Running-Sway-with-seatd,-elogind-or-systemd‐logind.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
Sway makes use of libseat to access seat devices through seatd or (e)logind, allowing sway to run without elevated privileges for input and output device access.
|
||||||
|
|
||||||
|
# systemd-logind
|
||||||
|
|
||||||
|
systemd-based distros should already have systemd-logind configured.
|
||||||
|
|
||||||
|
Running `sway` from an interactive, physical login session should detect and utilize the logind. Default PAM configurations will not allow you to start sway from SSH sessions or similar.
|
||||||
|
|
||||||
|
Note that seatd is checked for first, and sway output will contain a message about seatd failing and the next backend being attempted. This is expected and not an error, as indicated by the message.
|
||||||
|
|
||||||
|
# elogind
|
||||||
|
|
||||||
|
[`elogind`](https://github.com/elogind/elogind) is a project to take systemd's logind and separate it into an external program that can be run without the rest of systemd. The `elogind` service must be started and enabled before use, and the `pam_elogind.so` PAM module appropriately configured.
|
||||||
|
|
||||||
|
Running `sway` from an interactive, physical login session should detect and utilize elogind. Default PAM configurations will not allow you to start sway from SSH sessions or similar.
|
||||||
|
|
||||||
|
Note that seatd is checked for first, and sway output will contain a message about seatd failing and the next backend being attempted. This is expected and not an error, as indicated by the message.
|
||||||
|
|
||||||
|
# seatd
|
||||||
|
|
||||||
|
[`seatd`](https://github.com/kennylevinsen/seatd) is a novel and portable seat management service, depending only on libc and working with BSDs just as well as Linux. In order to use `seatd`, install `seatd`, and if your distribution has separate packages for init scripts, `seatd-<init-system>` or equivalent. After that, add the user that needs to launch sway to the `seat` group or equivalent for your distro (with `usermod -aG seat <user>`), and remember to logout in order for this to take effect. The seatd service should be enabled and started.
|
||||||
|
|
||||||
|
Running `sway` from anywhere as a user in the appropriate seat group should detect and utilize seatd.
|
||||||
|
|
||||||
|
# seatd-launch
|
||||||
|
|
||||||
|
If you don't want to enable the seatd service, it's possible to wrap the Sway command line inside `seatd-launch`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
seatd-launch -- sway
|
||||||
|
```
|
||||||
|
|
||||||
|
This will start a dedicated seatd instance for sway, and will stop seatd when sway exits.
|
|
@ -1,52 +0,0 @@
|
||||||
_Note: This page applies to Sway-1.0 with wlroots and later versions. It does not apply to 0.15_
|
|
||||||
|
|
||||||
Sway makes use of systemd's logind to handle sessions and allows sway to run without elevated privileges. This is the recommended way to use Sway.
|
|
||||||
|
|
||||||
However, we understand that not everybody is using a systemd-based distro, so sway has alternate ways to handle this.
|
|
||||||
|
|
||||||
Please note the non-logind way of using sway sees considerably less developer attention than using logind and you're more likely to run into issues. Please mention if you're not using logind in any support requests.
|
|
||||||
|
|
||||||
# elogind
|
|
||||||
|
|
||||||
[`elogind`](https://github.com/elogind/elogind) is a project to take systemd's logind and separate it into an external program that can be run without the rest of systemd. This is the recommended way for users not using systemd.
|
|
||||||
|
|
||||||
To use `elogind`, wlroots should be compiled with `-Dlogind-provider=elogind`, or it will try to use `libsystemd` instead.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
```
|
|
||||||
meson build -Dbuildtype=debugoptimized -Dlogind=enabled -Dlogind-provider=elogind
|
|
||||||
ninja -C build
|
|
||||||
sudo ninja -C build install
|
|
||||||
```
|
|
||||||
|
|
||||||
Make sure elogind is running and configured correctly before starting sway. Refer to your distribution's documentation for details.
|
|
||||||
|
|
||||||
# seatd
|
|
||||||
|
|
||||||
[`seatd`](https://github.com/kennylevinsen/seatd) is an open-source seat manager, i.e. a piece of software that manages processes' access to shared resources such as input and output devices, without the need for them to be root in order to acquire the needed privileges. On some distributions (e.g. Artix runit) `elogind` does not work with Sway, for some reason, so this instead can be used.
|
|
||||||
|
|
||||||
In order to use `seatd`, install the packages `seatd` and `seatd-<init-system>` (replace `<init-system>` with the init system in use, e.g. `seatd-runit`, `seatd-openrc`, etc.). Notice that this will uninstall `elogind-<init-system>` since the two packages are in conflict. After that, add the user that needs to launch Sway to the `seat` group (with `usermod -aG seat <user>`), and remember to logout in order for this to take effect.
|
|
||||||
You might need to enable the seatd service: `systemctl enable --now seatd`
|
|
||||||
|
|
||||||
Sway should be correctly starting with `seatd`. If this is not the case, it may be needed to set the global variable `LIBSEAT_BACKEND=seatd`.
|
|
||||||
|
|
||||||
# seatd-launch
|
|
||||||
|
|
||||||
If you don't want to enable the seatd service, it's possible to wrap the Sway command line inside `seatd-launch`:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
seatd-launch -- sway
|
|
||||||
```
|
|
||||||
|
|
||||||
This will start a dedicated seatd instance for Sway, and will stop seatd when Sway exits.
|
|
||||||
|
|
||||||
# Direct via setuid ([sway < 1.8](https://github.com/swaywm/sway/commit/e5728052b59f))
|
|
||||||
|
|
||||||
_Note: Attempting to run sway this way without this being configured correctly will probably leave your computer in an unresponsive state, requiring a reboot_
|
|
||||||
|
|
||||||
To have sway run as root in order to gain access to the resources you need, you must set the setuid bit on the sway executable:
|
|
||||||
```
|
|
||||||
chmod +s /usr/bin/sway
|
|
||||||
```
|
|
||||||
|
|
||||||
Sway will fork into a minimal slave process to keep these privileges, while dropping its own. As with any program, using setuid has serious security implications.
|
|
Loading…
Reference in a new issue