[systemd-devel] How to interact with `systemd --user`?

Kok, Auke-jan H auke-jan.h.kok at intel.com
Thu Jun 14 12:43:42 PDT 2012


On Thu, Jun 14, 2012 at 12:29 PM, Ciprian Dorin Craciun
<ciprian.craciun at gmail.com> wrote:
>    Hello all!
>
>    I want to play a little with systemd, but first I want to use it
> in a "sandbox" user, thus I start it (as non-root) from a console with
>      systemd --log-level=info --default-standard-output=inherit
> --default-standard-error=inherit

no need for any of those arguments, but, you forgot to add --user:

$ /usr/lib/systemd/systemd --user

But, you should really execute it from a unit file, which allows you to
get a PAM logon for the session, which ends up giving you the goodness that
you need:

[Service]
User=%I
PAMname=login   (or system-shared, if you have that /etc/pam.d file)

In other words, you should just do this as root:

# systemctl start user@<username>.service

>    Unfortunately I'm unable to figure it out how to interact with
> systemd... It seems `systemctl` complains about not being able to
> connect to D-BUS, and after checking the Internet and `strace`-ing it
> I figured that it only works with the systemd as PID 1...

you need to set DBUS_SESSION_BUS_ADDRESS for the systemd --user instance,
and use $ systemctl --user to interact with it.

Please read my other posts about the user session. There's a lot of this info
captured in there.

Cheers,

Auke


More information about the systemd-devel mailing list