Name: ccurt1 Date: December 26, 2003 at 08:16:58 Pacific Subject: Monitoring logons OS: win xp CPU/Ram: 512 ram
Comment:
Hi I have a problem with users logging on to a unix server and am trying to see if there is a way to track the users , logon time and commands they are using. Quite problematic not knowing when strange problems occur with the unix server. Thanks , Cman
If you have root on this system, you may want to try this.
I added the following line to each users .profile to start tracking user logins. This will just send you mail as soon as the user logs in, which saves you from logging on to the system and checking often. Just besure your sendmail queue is set low, like a few seconds, not like the default which i think is 15 minutes, so you will know right away.
last -a|head|mailx -s "server1 user1 login `date +\%c`" YourEmailHere@work.com
As far as watching commands used, you may want to run some kind of snoop or network/system sniffer to monitor activity.
Haven't tried this but presumably you could place the code in /etc/profile rather than repeating it everywhere. I would be concerned about the number of e-mails you might generate though.
If you don't need e-mail alerts, last on its own might be enough.