[systemd-devel] login/logout hooks in fedora 17?

Lennart Poettering lennart at poettering.net
Mon Jun 18 09:45:40 PDT 2012


On Thu, 14.06.12 11:15, Fernando Lopez-Lezcano (nando at ccrma.Stanford.EDU) wrote:

Heya,

> Hi all,
> Any suggestions on how I may run a script when a user logins or logouts
> of the graphical console? I used to do this with gdm by customizing the
> Post* and Pre* scripts in /etc/gdm.
> 
> I see that the login/logout process is (appears to be) controlled by
> systemd. What would be a good approach to getting the system to run a
> script before a user logs in and after a user logs out (ie: for local
> users sitting at the console - probably now called a seat if I
> understand things correctly).
> 
> Thanks for any advice!

Hmm, so there are multiple ways to achieve this, but it really depends
on what you are trying to do here. May I ask what kind of script you
want to run for a user logging in? Also do you want this to run
prviliged or unprivieleged?

One possible way is probably to hook this into the PAM session
setup/shutdown so that you can catch all types of logins with this. If
you need to run a script rather than write a PAM script a quick google
search reveals that pam-hooks might be the way to go?

Anyway, I can make a better recommendation with a few hints on the
intended usecases

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list