Operating System - HP-UX
1820355 Members
2744 Online
109623 Solutions
New Discussion юеВ

Log about login users and log about script execution

 

Log about login users and log about script execution

Hi,
i need to know the time that an user logged in my server and the time that he/she left it.
Also, how to know (or where) about the time that a specific script was executed ...

Best regards,

Christian
Christian Aguilar
2 REPLIES 2
Patrick Wallek
Honored Contributor

Re: Log about login users and log about script execution

You can check users login and logout times by using the 'last' command.

# last

will give all instances of a users logons.

# man last

for more details.

As to when a script was executed -- If it was from someones session, that is going to be almost impossible to tell. That kind of information is not kept anywhere.
Bill Hassell
Honored Contributor

Re: Log about login users and log about script execution

From a normal shell login, you can enable a log of the commands issued by the user. Just put this into /etc/profile:

export HISTFILE=~/.sh_history

Now each command the user types will be logged. The size of the file can also be controlled in /etc/profile:

export HISTSIZE=1000

It sounds like you are having problems with users, either they are not properly trained or they are getting into trouble. That is a sure sign that these users should be getting a shell prompt but instead are given a special menu script to limit their capability.


Bill Hassell, sysadmin