From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Knorr Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: Displaying last login time for a user Date: Fri, 29 Jul 2005 10:26:25 -0400 Message-ID: <000001c59449$825f1500$b4c8a8c0@hopsdc.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1122647842 28788 80.91.229.2 (29 Jul 2005 14:37:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Jul 2005 14:37:22 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Fri Jul 29 16:37:13 2005 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by ciao.gmane.org with smtp (Exim 4.43) id 1DyVyH-000327-Nr for gotm-tru64-unix-managers@gmane.org; Fri, 29 Jul 2005 16:36:22 +0200 Original-Received: (qmail 13714 invoked by uid 49509); 29 Jul 2005 14:35:56 -0000 Original-Sender: tru64-unix-managers-owner@ornl.gov Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 13699 invoked by uid 49501); 29 Jul 2005 14:35:56 -0000 Original-Received: from 160.91.86.17 by sws1 (envelope-from , uid 49491) with qmail-scanner-1.25 (clamdscan: 0.83/743. spamassassin: 3.0.2. Clear:RC:0(160.91.86.17):SA:0(-2.6/5.0):. Processed in 1.549567 secs); 29 Jul 2005 14:35:56 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 Original-Received: from emroute2.cind.ornl.gov (160.91.86.17) by sws1.ornl.gov with SMTP; 29 Jul 2005 14:35:54 -0000 Original-Received: from emroute2.cind.ornl.gov (LOCALHOST [127.0.0.1]) by emroute2.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0IKE005N18JMEC@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 29 Jul 2005 10:35:53 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute2.cind.ornl.gov by emroute2.cind.ornl.gov (PMDF V6.2-X27 #30899) id <0IKE00H028J903@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 29 Jul 2005 10:35:43 -0400 (EDT) Original-Received: from gull.hopsdc.com (gull.hopsdc.com [199.227.253.10]) by emroute2.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0IKE00E298I7VM@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 29 Jul 2005 10:35:33 -0400 (EDT) Original-Received: from cknorrlap ([192.168.200.180]) by gull.hopsdc.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 29 Jul 2005 10:26:29 -0400 Original-To: tru64-unix-managers@ornl.gov X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Envelope-From: X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on email.cind.ornl.gov X-Spam-Level: X-Qmail-Scanner-MOVED-X-Spam-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.0.4 X-OriginalArrivalTime: 29 Jul 2005 14:26:29.0061 (UTC) FILETIME=[825D6750:01C59449] Xref: news.gmane.org gmane.os.tru64.managers:8474 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:8474 QUESTION How do you determine the last time any of the users on my Tru64 Unix = V5.1B system have logged in. ANSWER(s) I got a lot of useful responses to this, all were useful in different = wants. I ultimately ended up using a script written by Chris Wincentsen that = uses 'finger'. RESPONSES It certainly looks from the reference page like lastlogin should do what = you seek. Since /usr/sbin/acct/lastlogin is in fact just a shell script, you = should be able to read it and figure out what it's doing. From a quick read, it = looks like it expects to find the information that it needs in the=20 /var/adm/acct/sum/loginlog file, which it looks like it creates if it's not present. This of = course begs the question of how that file is supposed to be kept up to date; I suspect you need to run accounting to have the data that the lastlogin script wants present in that file, but I could be off base, I have never = had to actually create and maintain accounting on a system myself. The data you want is probably somewhere in the wtmp file, since in most cases, that's where the accounting data is kept by the basic tools, but getting it into other useful forms is a challenge if you haven't = mastered the ins and outs of the Berkeley UNIX accounting that's at the core of = the Tru64 UNIX implementation. =3D=3D=3D=3D=3D=3D=3D=3D Not an exact answer for you, but this may help. I assume that you are = using C2 (enhanced) security, so "edauth -g" will get you all of the = information for a user. Then, look at the "u_suclog" field. This will give the = last successful login time, relative to the start of the epoch, for instance "1121952221". Then, perl -e 'print localtime(1121952221)."\n"' will convert that time to something useful: Thu Jul 21 08:23:41 2005 =3D=3D=3D=3D=3D=3D=3D=3D The "last" command can be used to read the /var/adm/wtmp file,=20 which also shows login duration times. =3D=3D=3D=3D=3D=3D=3D=3D If you have Enhanced Security enabled and haven't disabled login logging = in the Enhanced Security default file, the information you're looking for = is in the Enhanced Security account database, auth.db. You can look at this database with the edauth tool, but you'll have to convert the times from time_t format. See the Security manual and the man pages for edauth, prpasswd, and default. If you don't have Enhanced Security enabled or it's enabled but you have = to disable login logging, try enabling the audit subsystem. You can = configure the audit subsystem to log all kinds of neat stuff, including logins and logouts. See the Security manual for more information on the audit subsystem.