1 AUTHOR: Stef Bon <stef at bononline dot nl>
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: Execute scripts at begin and end of a KDE-session using KDM.
11 This hint is about the ability to execute scripts when a KDE session starts
14 Earlier I wrote a hint about this using PAM, with the help of the module
15 pam_script. I discovered that PAM is not the best place to do so. PAM is not
16 the place to start scripts, KDM is. KDM provides a very easy way via the
17 Xstartup and Xreset files to execute scripts. PAM has the abilty to do something
18 with the credentials provided at login, with the help of a module called
21 Original hint is on linux.bononline.nl,
22 "Installation and configuration of sessionscripts using KDM".
29 This hint requires sufficient knowledge of LINUX in general, and scripts in
37 3. TODO and suggestions
43 KDM uses some files to start and stop:
46 run as root, after a user succesfully logs in.
49 runs with permissions of the authorized user, to start the desired session (KDE).
52 run as root, after the user session has ended.
54 Where Xstartup is the place to start things up, Xreset is the place to undo these
57 For more information about these files look at the handbook of KDM.
59 By adding the following code to the Xstartup file:
64 for script in /etc/session.d/kdm/startup/*.sh; do
66 if [ -x $script ]; then
68 eval $script $USER kdm
75 and the code to the Xreset file:
80 for script in /etc/session.d/kdm/reset/*.sh; do
82 if [ -x $script ]; then
84 eval $script $USER kdm
91 Create the directories where the scripts go:
93 install -m755 -d /etc/session.d/kdm/startup
94 install -m755 -d /etc/session.d/kdm/reset
96 The files in these directories must be accessible for every ordinary user:
97 therefore the permissions are 755.
98 All scripts in these directories should have the same permissions: 755.
100 Every user should be able to execute the script, but only root is able to
109 I'm using this construction myself. The scripts which I let start when a (KDM)session starts are:
112 . dbus (the session part of it). I've written a hint how I've done this:
113 starting-and-stopping-dbus-with-kdm
116 . fusesmb (browsing the smb network using FUSE). I've written a hint about this too:
117 starting-and-stopping-fusesmb-with-kdm
119 . (un)mounting cifs shares.
122 . syncing directories from one central place using rsync.
125 The first two are described in hints also available.
127 Look at http://linux.bononline.nl, My projects,
128 "Installation and configuration of sessionscripts using KDM"
129 for the most recent documentation and scripts.
134 3. TODO and suggestions
135 -----------------------
137 The construction is working, but is not complete:
139 - it does no logging and proper userfeedback (on the screen)
140 with the hint xconsole_setup.txt (unmaintained: in hints/downloads/files)
141 you'll find a way to launch xconsole at startup by root. Using logger and
142 adjusting /etc/syslog.conf it's possible to write messages to it, which
143 appear just before the splash screen of KDE comes up.
144 On my website is described how to do that.
147 - scripts are executed in the order the command
149 for script in /etc/session.d/kdm/startup/*.sh; do
153 Maybe there should be an order. Some scripts first and others later. Just
154 like the rc script works to start and stop scripts in the /etc/rc.d structure.
157 - I'm testing FreeNX now. It turns your desktop into a terminalserver for
158 X11 sessions. You should test it!
159 There is a hint for LFS already!!
160 It does not work with KDM, so does nothing with the construction I'm using.
161 I'll check for a sollution.
165 * Thanks to the author of pam_script, Izak Burger, for his module and
172 * added chapter 3. TODO and suggestions
174 * removed all PAM related chapters. Soon a new hint only about this will follow.
176 * added a chapter about the examples
179 * add logging via xconsole