I'm investigating the migration of a bunch of machines from KDE to GNOME.
I currently have a collection of scripts which run when a user logs out. KDE provides an easy way to run these scripts - stick them in /opt/kde3/shutdown (or equivalent depending on distro). Any scripts in there get run as the user that's logged out.
The only suggestion I can find for doing this in GNOME is to put scripts in to /etc/gdm/PostSession. The trouble with that is that the scripts then run as root. Some of the scripts I need to run manipulate stuff in a the user's home directory which is mounted from a remote server and of course root doesn't have the ability to mess with stuff in such home directories. So a script which runs as root is at best annoying and at worse useless for my purposes.
I might be able to do something in the script like
su - $USER -c "some commands"
but that seems kinda messy and I haven't tested it yet.
Is there any sensible, easy method to make GNOME run a script when a user logs out with the permissions of that user?