I have a setup where my users log on using ldap and it works just fine.

I want to run a script after my users login (its a script that will detect which groups they are in and map network shares accordingly), and after they logout (umounting their shares).

Both scripts are done and they work.

I want that when the user logs in the box a script runs downloading the mounting script from my server (wget i guess?) and runs it, same thing for logout.

Can it be done? I've been searching the net and had no luck so far. I've managed to make that work on shell login/logout, but my users dont even know what shell is and have no use for it :)

  • 1
    Update: for versions 3 of Gnome Display Manager, the relevant folders are under /etc/gdm3. – vanadium Jul 18 '18 at 16:55

Found it.

/etc/gdm/PostLogin/Default for login script
/etc/gdm/PostSession/Default for logout script

I figured from Florian's suggestion that there should be something for gdm that did it :)

| improve this answer | |
  • 1
    Still works in 2019, confirmed on Ubuntu 18.04.01 in /etc/gdm3/PostSession – Ivan Ivković Feb 13 '19 at 15:17
  • Use /etc/X11/Xsession.d and /etc/X11/Xreset.d/

  • Maybe pam_mount (package libpam-mount in Ubuntu) can replace your solution.

| improve this answer | |
  • Wow that was fast :) Thanks Florian, I'll test this tomorrow when I get back to work. I'll take a look at pam_mount, I've had my fair share of headaches involving pam_* so I was trying to avoid it :P – Fernando Dec 7 '11 at 20:54
  • Sorry for the late response. Unfortunately this didnt work :/ libpam-mount wont do for my needs either. any other suggestions? – Fernando Dec 19 '11 at 12:31

I added the following to /etc/lightdm/lightdm.conf on Ubuntu Precise:


Works nicely every time.

Source: http://ubuntuforums.org/showthread.php?t=1969822&p=11892228#post11892228

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.