[pulseaudio-discuss] [PATCH] systemd: disable socket activation for root

Tanu Kaskinen tanuk at iki.fi
Fri Feb 3 08:51:10 UTC 2017


We disallow autospawning for root, but when using systemd socket
activation to start pulseaudio, that replaces the autospawning
mechanism, and there was no similar "root protection" in socket
activation. This patch disables the socket activation for root.

Thanks to Felipe Sateler for coming up with the idea of using
ConditionPathIsReadWrite=!/run.
---
 src/daemon/systemd/user/pulseaudio.socket | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/daemon/systemd/user/pulseaudio.socket b/src/daemon/systemd/user/pulseaudio.socket
index 332ece893..05459edc0 100644
--- a/src/daemon/systemd/user/pulseaudio.socket
+++ b/src/daemon/systemd/user/pulseaudio.socket
@@ -1,6 +1,13 @@
 [Unit]
 Description=Sound System
 
+# We don't want to enable socket activation for root, because alsa device
+# handover doesn't work between root and normal users. /run should be writable
+# only by root, so we use that to detect whether the current user is root.
+# A request has been submitted for a more straightforward way to detect the
+# current user: https://github.com/systemd/systemd/issues/5187
+ConditionPathIsReadWrite=!/run
+
 [Socket]
 Priority=6
 Backlog=5
-- 
2.11.0



More information about the pulseaudio-discuss mailing list