|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|||
|
Hey Guys,
i am new into shell programming and i have to do one script which have to record all the commands entered by a specific user. Example of that, i have a system running on unix, several users are using this system, i have to create like a databse which will record every user entered that system as well as recording all the commands being entered by that user. Can u help me in such case??? Thanks for your help.... |
| Sponsored Links |
|
|
|
|||
|
you can monitor for the changing time-stamps of history file of all the users and update your file or database with the changes alone from the history
(or) have a script command included in every user's profile to take a snapshot of all the commands, output and filter out for the commands alone from output of script command |
|
|||
|
have the following command in the .profile of every user
script -a $LOGNAME the above would generate all the output and commands entered in the file named $LOGNAME and while disconnecting from the session, the user has to specifically issue exit or ctrl-D twice to quit from script process and from the current shell where process script is spawned over the current shell later check for the file content redirected through script command and modify according to ur needs. And, to retrieve a copy of all the commands or characters entered by the user (including the control characters ) there should be a way to duplicate the output descriptor of the shell to redirect to STDOUT and the required filename. May be the Gurus would help regarding this !!! |
|
|||
|
Hi again and thanks for your help.
lets say i have a username of "charbel" and the default home directory of that user is "server/logs" from where he can get information by using the "grep" command on any file hw would like to look in in that specific home directory. Now what i have understand from you is that i have to create a .profile for each user and in that profile i have to include the command that u have just gave me in the above reply, right?!! Can you provide me with a sample of how would the script file look like ( the .profile and where shall that .profile to be located???...) i know i am asking for too much but i need it on urgent basis and sometimes i have the feeling i will not be able to do it and finish it early as required. Thanks again for your help. |
|
|||
|
Hello there,
ihave the following command in the .profle "script -a $LOGNAME" once the user logged out, the following file is created "typescript" which contains all the commands the user have entered and the output of those commands. Now i want to ask something, the user can access the output file "typescript" and modify it or even delete it,right??!! How can i prevent him from doig so, or can i copy the output file "typescript" to the root user and this file will be updated accordingly?? Hope to hear from u soon since this is mandatory to my job..... Thanks alot..... |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sar logs in /var/adm/sa | RobSand | Solaris | 1 | 10-03-2007 04:58 AM |
| logs | lordmod | UNIX for Advanced & Expert Users | 1 | 02-13-2007 06:41 PM |
| scp logs | gsr_kashyap | Linux | 0 | 08-02-2006 04:22 AM |
| rcp logs | ilkergu | HP-UX | 0 | 08-08-2005 04:51 AM |
| Logs | jtapia | UNIX Desktop for Dummies Questions & Answers | 4 | 03-28-2002 12:12 PM |