1748035 Members
4686 Online
108757 Solutions
New Discussion юеВ

Re: Bash History

 
SOLVED
Go to solution
Ghazanfar_2
Frequent Advisor

Bash History

Hi All,

I want to configure my commands history with time stamp, IP of machine from where HP-UX is accessed and username.

Thanks in advance
4 REPLIES 4
g3jza
Esteemed Contributor

Re: Bash History

Hi,
don't know if this is possible, you should be thinking about implementing Auditing to achieve something similar:

See audsys(1m), audevent(1m), audomon(1m) and audit.conf(4).
Ghazanfar_2
Frequent Advisor

Re: Bash History

You are right. I have already checked the four options but I want the precise information with no extra details thats why I think that through bash history I can get the required information.


Regards
Ghazanfar_2
Frequent Advisor

Re: Bash History

One more thing, that I can get the timestamp and username .... but the issue is with remotely accessing system IP.

Ralph Grothe
Honored Contributor
Solution

Re: Bash History

Is it that you run a Bash on an HP-UX box from which you require this data?

You could possibly tinker up your command prompt as a wild mixture of Bash PROMPTING (see man bash) and the HP-UX implementation of the "who" command (note, the GNU/Linux who has different syntax).
Maybe something like this (where I haven't converted the login's originating remote hostname into its IP as demanded (you could use HP-UX's getip command, or dig, host, nslookup etc to this end) would do?

PS1='[\t '$(who -mR|awk '{sub("\(","",$NF);sub("\)","",$NF);print$1"<="$NF}')']\n\$ '
Madness, thy name is system administration