History with Session info


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users History with Session info
# 1  
Old 08-02-2017
History with Session info

Hello Unix Gurus,

I am in the need to capture the terminal info a command was executed from in the history. Currently history lists only the time and command, but does not list the terminal that can help associate the command to an individual.

So my ask is - is there a way to capture/append the terminal info (we can map the terminal to the connecting session/user form the authlog or similar) to the history command?

Thanks,
aBBy007
# 2  
Old 08-02-2017
Only if you rewrite the shell(s) that add data into the history file you are processing. The history (usually a shell built-in) utility doesn't write anything into a history file; it just reads and formats the data it finds there. In some shells the history utility may also be used to discard old history entries. But, it can't determine who added history entries to a history file after those entries have been written.
# 3  
Old 08-02-2017
Quote:
Originally Posted by abby007
.
.
.
that can help associate the command to an individual.
.
.
.
Isn't the history file saved in the respective user's home directory?
# 4  
Old 08-02-2017
Quote:
Originally Posted by RudiC
Isn't the history file saved in the respective user's home directory?
By default, yes. But if the HISTFILE variable is set before the 1st interactive command is executed by a shell, the pathname in that variable will be used instead of $HOME/.sh_history if the user running that shell has the privileges needed to create and/or write to that pathname.
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Current Session History

Dear All, I want to display the command related to current session in Redhat Linux 5. Below history command display all the command in ~/.bash_history file. $history My requirement is the command executed in my current session.I mean to say. Suppose after log in as root i executed ... (1 Reply)
Discussion started by: monojcool
1 Replies

2. Red Hat

Tracking All session history in one file

Dear All, I want to keep all the session history in one file,please help me out to configure so. Here is the test scenario- Suppose i have three client A,B and C tries to log in to one Server XA there session specific command and Clint IPADDRESS should get logged in one file...like ... (0 Replies)
Discussion started by: monojcool
0 Replies

3. 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

4. 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

5. Solaris

Difference between the desktop session and console session

what is the difference between desktop session and console session in solaris as i am wondering we use option -text for the former and -nowin for the later (1 Reply)
Discussion started by: kishanreddy
1 Replies

6. UNIX for Dummies Questions & Answers

bash history - each session in different file

Hello How to configure, or where to have each session history in different file Example: someone is connecting as root and at this time is creating file in which we have history of executed command to server is connecting another user and is created another file with command executed by... (1 Reply)
Discussion started by: vikus
1 Replies

7. Solaris

I am not able to login in gnome session and java session in Sun solaris 9& 10

I am not able to login in gnome session and java session in Sun solaris 9& 10 respectively through xmanager as a nis user, I am able to login in common desktop , but gnome session its not allowing , when I have given login credentials, its coming back to login screen, what shoul I do to allow nis... (0 Replies)
Discussion started by: durgaprasadr13
0 Replies

8. Shell Programming and Scripting

Hiding Directories on a Session by Session basis

Hi, Apologies if anyone has read my recent post on the same subject in the Linux forum, just thought actually the solution might more likely come from scripting. Essentially, I am trying to restrict access to directories based on the user's name AND their location on a session-by-session... (3 Replies)
Discussion started by: en7smb
3 Replies

9. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies
Login or Register to Ask a Question