[systemd-bugs] [Bug 86727] New: systemctl --user should allow to specify which user we want to query/update
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Nov 26 00:33:53 PST 2014
https://bugs.freedesktop.org/show_bug.cgi?id=86727
Bug ID: 86727
Summary: systemctl --user should allow to specify which user we
want to query/update
Product: systemd
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: general
Assignee: systemd-bugs at lists.freedesktop.org
Reporter: mildred-bug.freedesktop at mildred.fr
QA Contact: systemd-bugs at lists.freedesktop.org
It should be possible as root to look at / update user units for selected
users. Especially since some of these users might not have tha ability to log
in at all (system-like users).
The use case that led to this bug report involves enabling and starting a user
unit for a 'pulseaudio' user running a 'pulseaudio.service' unit in order to
have a network sound server. The 'pulseaudio' user is set to have no password
(and this cannot login) and starts at boot because it was configured using
'loginctl enable-linger pulseaudio'
What I wanted to do was:
systemctl --user=pulseaudio enable pulseaudio.service
systemctl --user=pulseaudio start pulseaudio.service
systemctl --user=pulseaudio status pulseaudio.service
(but the --user option do not take an argument)
What I tried to do instead was:
sudo -u pulseaudio systemctl --user enable pulseaudio.service
sudo -u pulseaudio systemctl --user start pulseaudio.service
sudo -u pulseaudio systemctl --user status pulseaudio.service
(or some other variation using 'su' or 'su -l' instead of 'sudo')
That didn't work because the XDG_RUNTOME_DIR was not set. This could have been
caused by either (or both):
* /etc/pam.d/{su,su-l,sudo} not using the pam_systemd.so module at all
* pam_systemd.so not setting the environment variable. I suggest you look at
bug reports like https://bugzilla.redhat.com/show_bug.cgi?id=753882 or
bug #70810
What I ended up doing was something like:
su pulseaucio -c '
XDG_RUNTIME_DIR=/run/user/$(id -u)
systemctl --user enable pulseaudio.service
systemctl --user start pulseaudio.service
systemctl --user status pulseaudio.service
'
I don't loke it, especially setting the XDG_RUNTIME_DIR that was. This is
implementation specific and not portable. That's why I suggest you provide a
way to select the user session on the command line.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20141126/b895a6c5/attachment.html>
More information about the systemd-bugs
mailing list