Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I want to write a script or some kind of set up which will alert me when somebody other than me is loggin to the server with my login.say it shud send me out an email that from this ip address-somebody is using my loggin.and a possibility to warn them when they exceed the xx hrs of time.to log out.Thanks for your help.
Regards,
Dev

what makes you think this is "small"?
does "somebody other than me" mean there are more than 1 logins with your login?
what is your script writing experience?
what scripting languages?

I dont know that I would even bother writing a script for this. The easiest way would be to edit your .login file. As an example and what you are looking for, mine looks like this:
last -1 username | mail -s "Logged in" email@address.com
bash
last -1 username | mail -s "Logged out" email@address.comWhat this does is before my shell, bash, starts it reads the last login using last, and mails it to me. Then it runs bash, so the user will do what they are going to do. Then after they log out of bash and right before the connection is lost, the last command is run again to mail me that they have left the shell, logging out.

#if test $REMOTEHOST = yourmachinename
if test $REMOTEHOST
then
echo "$REMOTEHOST logged in" > info.txt
Dt=`date`
mail -s "log info" name@place.com < info.txt
echo At $Dt : $REMOTEHOST logged in >>.logusers
else
REMOTEHOST=$HOSTNAME
echo -n Hai!!!
echo "Have A Good Day!!!"
fi
Jc

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |