User script at logout
Posted
by
GUI Junkie
on Ask Ubuntu
See other posts from Ask Ubuntu
or by GUI Junkie
Published on 2012-03-19T10:15:37Z
Indexed on
2012/03/19
10:18 UTC
Read the original article
Hit count: 259
The problem: I'm sharing a directory with my wife. I've placed us both in a 'shared' group and the directory belongs to the 'shared' group as well. Whenever one of us creates a file, this file belongs to user:user, instead of user:shared...
The solution: I can do sudo chown, but my wife can't. So, I want to run a script when I logout of the session.
If I understand correctly, the startup scripts go in /etc/init.d/ and the runlevel scripts go /etc/rc0.d/ where 0 is the runlevel (0-6).
Do the runlevel scripts execute only on exit/logout? Do these depend on the user, that is, I'd like to run it only for my user (not so important in this case, mind)? Should I place the script somewhere else?
Also, I imagine that the script will be run by root, so there's no need for sudo within the script, is that correct?
© Ask Ubuntu or respective owner