[systemd-devel] User services

Mike Kazantsev mk.fraggod at gmail.com
Mon Jan 23 05:51:52 PST 2012


On Mon, 23 Jan 2012 09:16:52 +0100
Christian Hesse <list at eworm.de> wrote:

> Hello everybody,
> 
> I think systemd caring about session is a great idea and I added
> "kill-session-processes=1" to systemd's configuration in pam files.
> However this brings some problems. (Two for me to be precisely.)
> 
> First one was tmux. Detaching a tmux session and logging off used to kill the
> tmux session as well. I fixed this with a patch by Ben Boeckel, adding pam
> support to tmux. The tmux server now starts a pam session, thus systemd does
> no longer kill it. If anybody is interested:
> http://www.eworm.de/download/linux/tmux-pam.patch
> (Though the tmux maintains are not willing to include it as they think it's a
> design flaw in systemd to kill processes if a session ends.)
> 
> Ok, now my "real" problem. How about services started for a user?
> ssh-agent for example suffers the same problem. I used to start one instance
> per user, sharing socket information via temporary file. systemd kills
> ssh-agent if my first session is closed, leaving all others without
> authentication daemon.
> 
> Anybody with a solution for that?
> I thought about a ssh-agent at .service file that has a service section like
> that:
> 
> [Service]
> Type=forking
> User=%i
> ExecStart=/usr/bin/ssh-agent > /run/ssh-agent@%i
> 
> But I could not find a solution how to start a process for a user. Any
> thoughts, solutions, whatelse?

No solutions from me, sorry, but I think I can outline one more problem
- "mount" command and fuse filesystems.

If you do "mount /somewhere/something" as user (think remount from an
ssh session on a server), fuse-created process (sshfs, unionfs, ...)
will be spawned in user's session regardless of whether .mount unit
exists for that particular mountpoint.
When user exits, process will be killed, and any operation on the
mountpoint will produce something like ESHUTDOWN, without really
unmounting anything either.


-- 
Mike Kazantsev // fraggod.net


More information about the systemd-devel mailing list