Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!convex.UUCP!root From: root@convex.UUCP (Superuser) Newsgroups: comp.windows.x Subject: Lost mail for you Message-ID: <9006071736.AA16218@sushi> Date: 7 Jun 90 17:36:10 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 98 From pescadero.stanford.edu!expo.lcs.mit.edu!xpert-mailer Fri Jun 1 21:30:32 1990 remote from convex Received: by sushi (5.51/7.0) id AA06136; Fri, 1 Jun 90 21:30:32 CDT Received: by convex.COM (5.51/4.7) id AA09109; Fri, 1 Jun 90 21:30:27 CDT Received: from Erebus.Stanford.EDU by uxc.cso.uiuc.edu with SMTP (5.62+/IDA-1.2.8-900601) id AA02612 (for salevin%drlc1.UUCP@convex.com); Fri, 1 Jun 90 21:25:46 -0500 Received: from Hanauma.Stanford.EDU by erebus.Stanford.EDU with TCP; Fri, 1 Jun 90 19:27:54 PDT Received: by hanauma.stanford.edu (5.51/7.0) id AA00140; Fri, 1 Jun 90 19:25:34 PDT Received: from EXPO.LCS.MIT.EDU by Pescadero.Stanford.EDU (5.59/25-eef) id AA24896; Fri, 1 Jun 90 19:24:32 PDT Received: by expo.lcs.mit.edu; Fri, 1 Jun 90 16:34:43 EDT Received: from NSFnet-Relay.AC.UK by expo.lcs.mit.edu; Fri, 1 Jun 90 16:34:20 EDT Received: from sun.nsfnet-relay.ac.uk by vax.NSFnet-Relay.AC.UK via Janet with NIFTP id ab07662; 1 Jun 90 21:22 BST Received: from uk.ac.oxford.prg.boothp1 (boothp1) by prg.oxford.ac.uk id AA10949; Fri, 1 Jun 90 21:30:20 +0100 Received: by uk.ac.oxford.prg.boothp1 (3.2/prg.1) id AA00442; Fri, 1 Jun 90 21:31:45 BST Date: Fri, 1 Jun 90 21:31:45 BST From: convex!prg.oxford.ac.uk!Mark.Bush Message-Id: <9006012031.AA00442@uk.ac.oxford.prg.boothp1> To: xpert@expo.lcs.mit.edu Subject: Re: How to get xdm to make wtmp and utmp file entries? > In article , > mjd@central.cis.upenn.edu (Mark-Jason Dominus) writes: > |> > |> Our xdm's don't seem to be logging logins and logouts in the > |> /etc/wtmp and /etc/utmp files. Is there a good way to get > |> them to do this, or is there a good reason why they > |> shouldn't? > > xdm doesn't make the entries in these files, but you can make the main > xterm do it with the +ut and -ls options. The +ut makes it write in the > /etc/utmp file and the -ls is required to make it write in the /etc/wtmp > file. The -ls also makes it read and execute your .login file. The utmp file is world writable on many systems, but the wtmp file usually isn't. Even so, all that the -ls flag means is that the shell that is started is a login shell. This is done by prepending a `-' to the name of the shell. The xterm will add an entry to the utmp file but not the wtmp file. Normally it is `login' that writes the entry to the wtmp file. This hassle with these files is a pain. I have written two programs to sort this stuff out. One (xlogin) is called from the Xstartup file (see xdm(1)) and sticks a fake console entry into the utmp file for the user logging in and adds an entry to wtmp. The other (xlogout) is called from the Xreset file and removes the console entry from utmp and adds a logout entry to wtmp. In Xstartup I have: ------------------------------------------------------------------------------- #! /bin/sh if [ -f /etc/xlogin ]; then /etc/xlogin $USER fi if [ -f /etc/motd ]; then (cat /etc/motd) > /dev/console fi if [ -f /usr/ucb/quota ]; then (/usr/ucb/quota $USER) > /dev/console fi if [ -s /usr/spool/mail/$USER ]; then (echo You have mail) > /dev/console fi if [ -f /etc/nologin ]; then (cat /etc/nologin) > /dev/console exit 1 fi exit 0 ------------------------------------------------------------------------------- and in Xreset I have: ------------------------------------------------------------------------------- #! /bin/sh if [ -f /etc/xlogout ]; then /etc/xlogout fi ------------------------------------------------------------------------------- This keeps logging info happy, but since the console is never used, the person's fake console entry has a looooonnnng idle time. Does anyone have a better way of doing this sort of thing? If anyone wants the source for my xlogin and xlogout then mail me. They are not exactly elegant, but they do their job. Mark