Solution: logging X windows sessions with sessreg

Solution: logging X windows sessions with sessreg

Post by Derek Dress » Fri, 08 Feb 2002 22:36:02


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/Xstartup

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


/usr/X11R6/bin/sessreg -a -l $DISPLAY -x /etc/X11/xdm/Xservers $USER


/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.



Solution: logging X windows sessions with sessreg

Post by Derek Dress » Mon, 11 Feb 2002 23:37:51


One small correction in my earlier post.  Replace the following:

Quote:> DisplayManager*startup:    /etc/X11/xdm/Xstartup
> DisplayManager*reset:      /etc/X11/xdm/Xstartup


DisplayManager*startup     /etc/X11/xdm/Xstartup
DisplayManager*reste       /etc/X11/xdm/Xreset



1. xdm/sessreg problem (with solution:)

The manual to sessreg tells you to log the xdm login to both wtmp and
utmp, which I think is plain wrong.  The flags "-u none" should be
added to disable utmp logging, or you will get:

finger <user from xterminal>

finger: Can't stat /dev/<truncated hostname of the terminal>

Since Sun even sells X-terminals, I wonder if anybody ever tried to use
one?! If so, perhaps mentioning sessreg usage in the xdm manual section
about Xstartup scripts would be nice, too.


2. Copying files

3. SOLUTION: Solaris 2.3: How to increase number of window sessions?

4. PC mail order companies?

5. Switch between tty session and X-window session

6. Help: Looking for Linux commands reference!

7. I want to see a X-Windows session in some sort of Windows 2000 client

8. Default route per interface in AIX 4.3.3??

9. X-Windows session on Windows 2000?

10. Session Data in multiple browser windows: Configuration of Unix vs. Windows Apache?

11. SOLUTION: graceful shutdown after keyboard lock/also kill hung X session

12. logging out a x session

13. How can I log everything what a user does in a session