> I have a university telnet account and I suspect that somebody may have
> gotten my password. I will of course change it but for the future I thought of
> an idea of writing a simple shell script that will execute upon login and
> log the date and time of the login into a file (hopefully, however logs in
> will not look at this file). I am not a very
> experienced shell script writer so I would appreciate if anybody could
> walk me through doing this. Thanks for any help.
On many systems, the login welcome text will often say something
on the lines of "Last login: Sat Oct 11 18:57:02 2003" or even
"Last login: Sat Oct 11 11:39:09 2003 from 62.253.xxx.xxx".
Logging log-ins to the account itself if useless. Once the
other person sees the log, he can modify the logs in any way he
A better way would be to to do something like this in your $ENV
( who | grep $LOGNAME; env ) | \
The file specified in the $ENV variable is run once when
invoking an interactive shell but not for non-interactive shells
(that's for ksh93 at least). Check the invocation section of
the manual for your shell.