Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
# 1  
Error Logs

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....
# 2  
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


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
# 3  
Thanks alot,
i would like to choose the second option, but i really dont know how to perform that, can u help in this?

Thanks in advance
# 4  
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.


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 !!!
# 5  
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.
# 6  
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.....
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

2. Shell Programming and Scripting

Need logs 5 mins old

I need 5 mins old logs to be dumped into a a new file. The date formats in the two log files are Can you suggect for both formats ? bash-3.2$ uname -a SunOS myserver 5.10 Generic_150400-26 sun4v sparc sun4v ---------- Post updated 05-04-16 at 12:24 AM ---------- Previous update was... (2 Replies)
Discussion started by: mohtashims
2 Replies

3. AIX

Apache logs

Hi, I can't seem to find the apache logs in my system. Can anyone assist me on finding them? This was done with a RPM install. I've checked everywhere and even tried a find command with key names like httpd and apache. and i've come up with nothing except my conf files. (2 Replies)
Discussion started by: vpundit
2 Replies

4. Shell Programming and Scripting

monitor new logs

I would like to monitor logfile for specific keyword and send email once detected. I'm trying out the code here, the script is scheduled to run every minute. Everytime it runs, the same log will be detected and send email. Anyway it can be improved to detect only new logs? tail -f /logfile |... (2 Replies)
Discussion started by: gklntn
2 Replies

5. UNIX Desktop Questions & Answers

regarding logs

Hi , I am running an application on my windows and it logs are generated at /var/logs and for this i have to go this location and then do tail -f , Is there any command you can advise me so that when I execute this command at this location that logs get displayed fully and as the application... (3 Replies)
Discussion started by: KAREENA18
3 Replies

6. Shell Programming and Scripting

Logs Presentation

Hello All, I am trying to capture system logs for specific tools run by users. So my script create logs from 10 different server.So is there any script & tool from that i can read or present them easily ?. Regards Ankit (1 Reply)
Discussion started by: ajaincv
1 Replies

7. Shell Programming and Scripting

Grep yesterday logs from weblogic logs

Hi, I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows: """"""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies

8. UNIX for Advanced & Expert Users


Hy, I have a question I have a directory in a unix server, Some of my files have a diffrent access time, from the time i accessed them last, I think some one has copied it,it's not an important file,but none the less,it is my file,It mistakenly had a 777 permission( yes ,I know it is a noob's... (1 Reply)
Discussion started by: lordmod
1 Replies

9. UNIX for Dummies Questions & Answers


can i include this command into my crontab file > /var/adm/wtmp to clear the contents on a regular basis ? what about file permissions ? (6 Replies)
Discussion started by: cubicle^dweller
6 Replies

10. UNIX Desktop Questions & Answers


hi My name is Juan I dont can clear wtmp and similiar files how i do it? thanks (4 Replies)
Discussion started by: jtapia
4 Replies

Featured Tech Videos