- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- need more teeth into .sh_history file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 01:55 PM
04-25-2002 01:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 02:12 PM
04-25-2002 02:12 PM
Re: need more teeth into .sh_history file
Good question. The closest I have ever gotten was in the .profile add
date >> .sh_history
to the bottom line.
That will give you a time line per instance.Not per command.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2002 05:48 PM
04-25-2002 05:48 PM
Re: need more teeth into .sh_history file
Also, each user ean edit his/her own sh_history file, so this may not be such a good place to look for adding more teeth.
If you really need tighter auditing, consider using BigBrother ( http://bb4.com/ )

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2002 03:25 AM
04-26-2002 03:25 AM
Re: need more teeth into .sh_history file
export HISTFILE=/tmp/.hist$$
laters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2002 03:49 AM
04-26-2002 03:49 AM
SolutionAdd the following to .profile:-
--------------------------------
# Date stamp (When logged in) >> .sh_history
# Who logged in (From where)
date >> ~/.sh_history
who -u|grep root >> ~/.sh_history
-------------------------------
Change the grep to suit the user.
Entry in .sh_history will look like :-
----------------------------------
Mon Mar 19 17:21:19 GMT 2001
root pts/tDb Mar 19 17:21 . 1375 172.20.1.118
cd etc
cat passwd |grep avap
exit -----------------------------------
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2002 08:36 AM
04-26-2002 08:36 AM
Re: need more teeth into .sh_history file
What I needed is this
Entry in .sh_history should look like :-
----------------------------------
Mar 19 17:21:19 $PS1 cd etc
Mar 19 17:30:19 $PS1 cat passwd |grep avap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2002 08:42 AM
04-26-2002 08:42 AM
Re: need more teeth into .sh_history file
To my knowlege, that can not be done by conventinal means.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2002 08:53 AM
04-26-2002 08:53 AM
Re: need more teeth into .sh_history file
I think you need to enable accounting in your system inorder to do this. This will keep track of each command, time, user, processes etc. See this for more details:
# man 1M acct
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2002 11:45 AM
04-26-2002 11:45 AM
Re: need more teeth into .sh_history file
date >> .sh_history
then you can have a rough idea which command was issued at when -- change cronjob frequency with your demand.
thanks,
Gary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 10:48 AM
04-29-2002 10:48 AM
Re: need more teeth into .sh_history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:13 AM
04-29-2002 11:13 AM
Re: need more teeth into .sh_history file
readonly HISTFILE="${HOME}/.sh_history_`date +%y%m%d.%H%M%S`.$$"
readonly HISTSIZE=50000
export HISTFILE HISTSIZE
Of course you need to maintain them (DELETE them) after you have done what you wish to do with them.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 11:58 AM
04-29-2002 11:58 AM
Re: need more teeth into .sh_history file
print -s `/sbin/date`
print -s `/usr/bin/who -um`
You can set these commands in users' .profile or in a script (to be executed by cron).
The point is that the standard output re-direction may corrupt your command line history mechanism.
If you want a timestamp on the same line with the command line, that may also corrupt your command line history mechanism.
For more information on 'print -s' do 'man sh-posix'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 07:28 AM
04-30-2002 07:28 AM
Re: need more teeth into .sh_history file
I guess the only way would be turn on accounting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 08:59 AM
04-30-2002 08:59 AM
Re: need more teeth into .sh_history file
have you considered using "script"?
That way you can have the commmands AND their output in a logfile, and if you put the date&time into your prompt, you'll get what you asked for...
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:46 AM
04-30-2002 09:46 AM
Re: need more teeth into .sh_history file
I needed this to keep a track of user commands for any misbehaviour diagnosis or flaw detection..etc
And the format I was looking for is as below....Timestamp..Command (no output) & paths.
example.
Mar 19 17:21:19 $PS1 cd etc
Mar 19 17:30:19 $PS1 cat passwd |grep avap
Anyway , thanks for all the help.
As I said earlier I may have to look at accouting.
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:57 AM
04-30-2002 09:57 AM
Re: need more teeth into .sh_history file
script -a /audit/`id -un`.auditfile
Im sure these will fill up fast. So be sure to set some kind of auto log cleanup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:08 AM
04-30-2002 10:08 AM
Re: need more teeth into .sh_history file
How about adding the date command to their prompt?
As in:
export PS1="`date`(!)`whoami`# "
Put this in their .profile. If need be you can lock down write access to their .profile so they can't mess with it.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:10 AM
04-30-2002 10:10 AM
Re: need more teeth into .sh_history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:13 AM
04-30-2002 10:13 AM
Re: need more teeth into .sh_history file
cat /audit/username.auditfile | grep "A_Key_Word_form_the_prompt"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:16 AM
04-30-2002 10:16 AM
Re: need more teeth into .sh_history file
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:19 AM
04-30-2002 10:19 AM
Re: need more teeth into .sh_history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:37 AM
04-30-2002 10:37 AM
Re: need more teeth into .sh_history file
Pete
Pete