Hi, 

I've been wanting a way to track the usage of our LTSP terminals
and kiosks.  Our setup is almost a year old.  Maybe all this stuff
has been covered in the newer sources.

After some trial and error, I figured out a way to log remote X
terminal sessions to utmp.  I am using KDM, but it should be the same
for XDM.  My system is Redhat 7.1 
First, I edited
/etc/X11/xdm/xdm-config  
and added the following lines.  I put these
at the end of the first section, before the SECURITY section. 

DisplayManager*startup:    /etc/X11/xdm/Xstartup
DisplayManager*reset:      /etc/X11/xdm/Xreset 

This will cause those files to be executed during the beginning and
end of an X session then you need to create those files to look like 
/etc/X11/xdm/Xstartup
***************************
#!/bin/sh /usr/X11R6/bin/sessreg -a -l $DISPLAY -x /etc/X11/xdm/Xservers $USER 

/etc/X11/xdm/Xreset
****************************
#!/bin/sh /usr/X11R6/bin/sessreg -d -l $DISPLAY -x /etc/X11/xdm/Xservers $USER 

next, make sure that those two files are executable
chmod 755 /etc/X11/xdm/Xreset
chmod 755 /etc/X11/xdm/Xstartup 

finally, set the sessreg program setuid root

WARNING! : this does have some security implications, make sure you
understand them and accept the risks before doing this. 

chmod u+s /usr/X11R6/bin/sessreg 

next restart kdm (or xdm if that's what you are using).  I think this
is different for GDM, but I don't use that so I'm not sure.  You can
simply reboot if you aren't sure how to restart kdm. 

Now you should see X sessions logged in wtmp by using the 
last
command.

Yesterday was the first day of logging.  It was a pretty light day for a number of reasons and there were 206 logins by 99 separate users on our LTSP terminals.  cool !!!

Now I'm looking at writing some scripts to generate graphs of our LTSP terminal usage.  I'll post them if I get them put together.

HTH,
Derek
