Finding out when someone was LAST LOGGED ON
The short answer to this question is that there is no reliable way to
determine this information, unless the user has managed to make it easy
for you by providing it through customization. If you're interested in
knowing why this is the case, what information you CAN get, and how you
can customize your account for other people to determine this, read on....
In the old days, under NFS, there was a fairly reliable way to find out
someone's last log-in time. This involved taking a look at the last
access times on the various dot files they have in their home directory
that get accessed automatically when they log in. However, nowadays,
there are two problems that are posed with this old solution:
1. AFS sets permissions by directory, and not by file. The default
permissions are set up so that you can see the names of the files
in a person's home directory, but you can neither see their
content, nor information on their size or creation time.
2. While NFS maintained data for each file containing creation time,
last access time, and last modification time, AFS only monitors
the LAST of these. Therefore, you can't see the last time someone
read their .cshrc file, only the last time it was changed.
An alternative method you can use is to type the following at your athena%
prompt:
add consult
lastlog username
This is a program that uses slightly more sophisticated ways of finding
out the last time a user's AFS volume was written to. However, this
information can rarely be depended on for high accuracy.
For one thing, other users may write to a person's directory, which will
render the information inaccurate. Most commonly, the automatic file
expunger on the fileservers (the program which automatically removes files
you've gotten rid of with "delete" after three days) writes to your
volume, and that is not distinguished from a person's login in the lastlog
information.
The only reliable way, therefore, to determine the last time another user
has logged on is to have the other user tell you. This can be
accomplished in many ways, but the following is perhaps the simplest.
First, create a .project file that will be contained in your finger
information. To do so, type:
ln -s ~/Public/.project ~/.project
(You only need to do this once.) Then, if you add the following line to
your .logout file:
echo "Last logout: `date`" >! ~/Public/.project
it will rewrite the ".project" file whenever you log out, giving the
current time of your logout. Now, if another user attaches your directory
and fingers you, they will see the last time you logged out, which will
read:
Project: Last logout: Fri Feb 19 02:39:02 EST 1993
(Note: they MUST attach the directory; merely fingering it will not
display the .plan and .project files.)
This customization can also be expanded to include the last location of
your login, as well:
echo "Last logout: `date` from `hostname`" >! ~/.project
which will produce in your finger information:
Project: Last logout: Fri Feb 19 02:39:02 EST 1995 from W20-575-21
last updated: 7/16/96
|