Re: [systemd-devel] systemd user sessions?

2016-02-25 Thread Michael Chapman

On Wed, 24 Feb 2016, Jon Stanley wrote:

I'd like a systemd unit (and only that unit) to be controlled by a
specific user. The unit runs as this user, so I thought about user
instances of systemd. This service should be started when the system
starts, so you'd have to enable linger in systemd-logind for that to
work.

The question is how to make the systemd user *service* start at boot?


loginctl enable-linger $username

A user with lingering enabled will have their user instance started at 
boot and stopped at shutdown. The above command will immediately start the 
user instance if it is not already running (i.e. if the user does not 
currently have any sessions).


- Michael
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd user sessions?

2016-02-24 Thread Kai Krakow
Am Wed, 24 Feb 2016 17:41:57 +0100
schrieb Krzysztof Kotlenga :

> Jon Stanley wrote:
> 
> > I'd like a systemd unit (and only that unit) to be controlled by a
> > specific user. The unit runs as this user, so I thought about user
> > instances of systemd. This service should be started when the system
> > starts, so you'd have to enable linger in systemd-logind for that to
> > work.
> >
> > The question is how to make the systemd user *service* start at
> > boot?
> 
> [Install]
> WantedBy=default.target
> 
> $ systemctl --user enable foo.service
> Created symlink
> from /home/user/.config/systemd/user/default.target.wants/foo.service
> to /home/user/.config/systemd/user/foo.service.
> $
> 
> That's pretty much it.

I don't think this is how it works... User services do not start at
system boot but at user session start. So without starting the user
session on boot, the user service won't start.

I think it needs to be a system service, then use polkit rules to
enable a user to control this system service.

-- 
Regards,
Kai

Replies to list-only preferred.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd user sessions?

2016-02-24 Thread Krzysztof Kotlenga
Jon Stanley wrote:

> I'd like a systemd unit (and only that unit) to be controlled by a
> specific user. The unit runs as this user, so I thought about user
> instances of systemd. This service should be started when the system
> starts, so you'd have to enable linger in systemd-logind for that to
> work.
>
> The question is how to make the systemd user *service* start at boot?

[Install]
WantedBy=default.target

$ systemctl --user enable foo.service
Created symlink
from /home/user/.config/systemd/user/default.target.wants/foo.service
to /home/user/.config/systemd/user/foo.service.
$

That's pretty much it.

-- 
pocek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] systemd user sessions?

2016-02-24 Thread Jon Stanley
I'd like a systemd unit (and only that unit) to be controlled by a
specific user. The unit runs as this user, so I thought about user
instances of systemd. This service should be started when the system
starts, so you'd have to enable linger in systemd-logind for that to
work.

The question is how to make the systemd user *service* start at boot?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel