[systemd-devel] tmux / screen

Christian Hesse list at eworm.de
Thu Jun 16 00:07:03 PDT 2011

Lennart Poettering <lennart at poettering.net> on Wed, 15 Jun 2011 21:17:15
> On Fri, 27.05.11 16:45, Christian Hesse (list at eworm.de) wrote:
> > Hello everybody,
> > 
> > I've set up pam to use pam_systemd.so. This way tmux and screen work,
> > but other processes started in this session will continue to run after
> > the user logs out.
> > 
> > I would like to set kill-user=1 or kill-session=1, but that breaks tmux
> > and screen.
> > What is the correct fix for that? Do these applications need
> > support for pam? Calling pam_systemd themself and getting their own
> > cgroup could workaround this, doesn't it?
> Yes, if screen should be considered an independent session then it
> should invoke the PAM session hooks and systemd will do the right thing.
> In order not to break screen we currently do not set kill-user=1 or
> kill-session=1. 
> Note that in some cases it might be a good thing to kill screen sessions
> when the user otherwise logs out (think university, where students not
> logged in on a workstation should not be able to waste CPU), in other
> cases its a bad thing however (i.e. in yours). That means it must be
> configurable whether screen is considered an independent session or not.

Configuring this is up to the administrator. He/She would be able to
configure this in /etc/pam.d/{screen,tmux}.

I've asked in the tmux mailing list. Seems like the devs tend to not include
pam support:

> I'm not convinced tmux should need PAM support to do something perfectly
> normal.


> I don't think this is something the application should need to
> configure, you should be able to configure it in systemd [...]

I have a script that creates a new cgroup via libcgroup [0] and
launches tmux within this cgroup. If anybody is interested please take
a look at my Arch package [1].

IMHO this is just a workaround.
Sadly my programming skills did not allow to add pam support myself. If
anybody has a patch I would like to test.

[0] http://libcg.sf.net/
[1] http://arch.lugor.de/eworm/x86_64/tmux-cgroup-0.0.2-1-any.pkg.tar.xz
Schoene Gruesse

More information about the systemd-devel mailing list