Sponsored Content
Top Forums Shell Programming and Scripting History of all the users in single file with command , date . time , ip and user Post 302894783 by rehantayyab82 on Thursday 27th of March 2014 09:27:57 AM
Old 03-27-2014
History of all the users in single file with command , date . time , ip and user

HTML Code
Code:
archive_history() {     HISTORYOLD=${HISTFILE}.archive     CURTIME=`date`     CURTTY=`tty`     IP=$(echo $SSH_CLIENT | awk '{print $1}')        if  [ x$HISTDUMPPED = x ]; then                echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >>   $HISTORYOLD       history $(($HISTCMD-${CURBASHSTART-0})) | sed -e 's/^[ ]*[0-9][0-9]* [ ]*//g'  >> $HISTORYOLD       export HISTDUMPPED=1     fi }  exit () {    archive_history    builtin exit }

then add following line in .bash_logout in each user home's dir.


vi /home/oracle/ .bash_logout
Code:
archive_history >>  .bash_logout

you can see all details by like " command date ipaddress/username"
after doing above all step once login, run some command and then logout and then login
and then check "cat .bash_history.archive"









with your script i am getting output like this :


cat /home/oracle/.bash_history.archive
#-test2.fatima-group.com-- - Thu Mar 27 17:38:23 PKT 2014 (/dev/pts/2) oracle 10.1.8.226----
2014-03-27 17:38:23 logout
#-test2.fatima-group.com-- - Thu Mar 27 17:41:11 PKT 2014 (/dev/pts/4) oracle 10.1.8.244----
2014-03-27 17:41:11 logout
#-test2.fatima-group.com-- - Thu Mar 27 17:52:02 PKT 2014 (/dev/pts/3) oracle 10.1.8.226----
2014-03-27 17:52:02 logout



There are 2 problems , i mean which i want to fulfill my requirement

Problem 1 : i am not getting command which is executed by user

problem2 : i should get all details in .bash_history.archive even if i close my terminal ( i mean i just close my ssh terminal and dont type exit or logout )


thanks in advance


 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date/Time in history command

Hi, Can we display the Date/time stamp in history command Ex: $history output ----------- vi pr.sh ksh -x pr.sh ksh -n pr.sh nhoup ksh pr.sh & nohup ksh pr.sh & i want the output like this Tue Mar 14 17:18:57 GMT 2006 vi pr.sh HOSTNAME is it possible sir ???? (3 Replies)
Discussion started by: vastare
3 Replies

2. UNIX for Dummies Questions & Answers

last login date and time for all users

I need a command that will list all the users and their last login date & time. I was trying the last command and the who command, but can't get exactly what I need. I just need the output to be user name and last login date . Thanks for your help! (3 Replies)
Discussion started by: igidttam
3 Replies

3. HP-UX

How to enforce users not to modify their command history.

As a system administrator. sometimes we see the users are trying some commands dangerous for the system health and remove them from their individual coomand history file. How it is possible to enforce that the normal usres will will not be able to modify the history. Thanks in advance. Partha (4 Replies)
Discussion started by: partha_bhunia
4 Replies

4. UNIX for Dummies Questions & Answers

Date, time, users

i need to find out following ways to show out put in a shell script when the user selects that option in a case statement. I have the case statement already started just need to find out how to read the following: current date and time (should it be read date)? users logged in (should it be... (4 Replies)
Discussion started by: vthokiefan
4 Replies

5. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

6. UNIX for Dummies Questions & Answers

The history command: See other users command history

Can anyone tell this: If two users are logged into the same server from different locations. Is there a way to see the history command of the other user? I tried the history command, but it is showing me only the commands I used. Thanks in advance for your help. Iamnew2solaris (1 Reply)
Discussion started by: iamnew2solaris
1 Replies

7. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

8. Shell Programming and Scripting

Tracking users through history command

Hi folks, I have the basic query that there are 3 unix boxes having their individual access now in my team there are 4 members who are using the same credentials to access those 3 boxes through putty ssh from their windows desktop , now if i want to check which 4 members have executed the... (1 Reply)
Discussion started by: punpun66
1 Replies

9. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code: archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (0 Replies)
Discussion started by: rehantayyab82
0 Replies

10. UNIX for Beginners Questions & Answers

History of command by date

hi unix expert how can i see the history of command that i entered in past? history (1 Reply)
Discussion started by: abdossamad2003
1 Replies
ACTDIAG(1)						      General Commands Manual							ACTDIAG(1)

NAME
actdiag - generate activity-diagram image file from spec-text file. SYNOPSIS
actdiag [options] files DESCRIPTION
This manual page documents briefly the actdiag commands. actdiag is a program that generate activity-diagram image file from spec-text file. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. -h, --help show this help message and exit -a, --antialias Pass diagram image to anti-alias filter -c FILE, --config=FILE read configurations from FILE -o FILE write diagram to FILE -f FONT, --font=FONT use FONT to draw diagram -s, ----separate Separate diagram images for each group (SVG only) -T TYPE Output diagram as TYPE format SEE ALSO
The programs are documented fully by http://tk0miya.bitbucket.org/actdiag/build/html/index.html AUTHOR
actdiag was written by Takeshi Komiya <i.tkomiya@gmail.com> This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others). June 5, 2011 ACTDIAG(1)
All times are GMT -4. The time now is 08:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy