Operating System - HP-UX
1846607 Members
1412 Online
110256 Solutions
New Discussion

script for checking logins by certain users

 
Maurice Peterse
Frequent Advisor

script for checking logins by certain users

hello,

i need a script that tells me (by email)
what certain users (in 1 group) did (commands)
after each logout (of that user). It concerns all users
in 1 group on the system.

thanx!
8 REPLIES 8
Vincenzo Restuccia
Honored Contributor

Re: script for checking logins by certain users

Maurice Peterse
Frequent Advisor

Re: script for checking logins by certain users

i don't want to restrict any users, just a check on all commands used by all users in that 1 group...

and i'm no scripting-fan :/
Shannon Petry
Honored Contributor

Re: script for checking logins by certain users

The commands are not really trackable by normal means. Solution may be to setup a shell history on each user, large enough to fit their command sets, and email those to yourself.....
the problem even with doing that is that you may not be able to get a $HOME/.logout command to work on HP-UX.

All in all, I'd say it's a pretty good task. It could be done....but.....not very easily.

Regards,
Shannon
Microsoft. When do you want a virus today?
Maurice Peterse
Frequent Advisor

Re: script for checking logins by certain users

then we have a challenge here.

Can't i use a script that starts archiving the commands from the moment those users login to the moment where they logout?

Any help is appreciated!!
Ralph Grothe
Honored Contributor

Re: script for checking logins by certain users

Just as an addition to Shannon's reply.

If you place a .sh_logout script in the user's home dir and trap the exit of the shell in the user's .profile

e.g.:

trap 'test -x ${HOME}/.sh_logout && . ${HOME}/.sh_logout; exit' 0

you should be able to put any commands in the .sh_logout script (such as mailing you the user's .sh_history file), which will be executed on the user's logout.
Madness, thy name is system administration
Shannon Petry
Honored Contributor

Re: script for checking logins by certain users

There is no cheap/easy way of doing what you want. The standard UNIX accounting will be able to tell you when users log in, and what commands (accum total) that they have run, but not with any intelligence or order other than how much CPU/Memory and disk the command used for the duration of the accounting session.

As a consultant, I could make something, and make it work. I have custom accounting software at many locations. However you are talking an easy 2-3 days development, and testing for what you are looking for. This would be to try and avoid smart users, but would still have problems if a user was really smart.

Regards,
Shannon
Microsoft. When do you want a virus today?
Sundar_7
Honored Contributor

Re: script for checking logins by certain users

Hi

U may check out the man pages of

scripts command in HP-UX..

It saves all the commands issued by the user

and also its out put to a file.

Might be of interest to U..

Check it out

SUndar
Learn What to do ,How to do and more importantly When to do ?
Mark Vollmers
Esteemed Contributor

Re: script for checking logins by certain users

Maurice-

What exactly are you watching for for this particular group? Is this just to keep an eye on them in general or to see if they are using commands that they arn't supposed to be using? If it is the later, it might be easier to make a shell for the group that only allows them to use a few choice commands (I remember seeing a thread or two on this a while ago).

Mark
"We apologize for the inconvience" -God's last message to all creation, from Douglas Adams "So Long and Thanks for all the Fish"