- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Last commands
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
09-04-2005 04:32 PM
09-04-2005 04:32 PM
Last commands
I would like to trace the last executed commands on a HP box. I was unable to find it with the history command. Could any1 help me in finding out the last executed commands and also i wud like to find out from which telnet session has executed the command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2005 04:49 PM
09-04-2005 04:49 PM
Re: Last commands
The history file specified by HISTFILE contains the latest commands you executed at your terminal. Every time you type a command at the prompt and press Return it is stored in this history file. HISTSIZE specifies the maximum number of commands stored in that file. For example:
HISTFILE=/users/test/.history
HISTSIZE=20
If you do not set these two variables in your .profile, the shell defaults to a file named .sh_history of 128 lines.
The history mechanism keeps continuous record of the most recent commands you have executed, even if you log out and back into the system many times or execute the commands in a subshell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2005 05:44 PM
09-04-2005 05:44 PM
Re: Last commands
-- /etc/profile --
set -o vi
export $HISTFILE=$HOME/.sh_history
export $HISTSIZE=2000
ps | grep -q 'telnetd'
if [ $? -eq 0 ]
then
echo "Telnet sesssion logged $LOGNAME $(date)" >> $HISTFILE
fi
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2005 05:47 PM
09-04-2005 05:47 PM
Re: Last commands
Just write
script filename
in .profile and everthing the user does will be recorded in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2005 01:38 AM
09-05-2005 01:38 AM
Re: Last commands
maybe also command "last",
with -R option, can be useful
to pinpoint who and which telnet session
were executed.
hth
regards
pg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2005 01:43 AM
09-05-2005 01:43 AM
Re: Last commands
HISTFILE=/tmp/`who -u am i|awk '{ print $1"_"$8"_"$2 }'|sed 's/\///g'`.hist
So you will get, for each user that logs in the server, separate history files under /tmp
( for example: /tmp/root_10.115.0.3_pts0.hist )
Regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2005 02:00 AM
09-05-2005 02:00 AM
Re: Last commands
You can also check with last and lastb command , for lastlogin and badlogins.
You can also enable audit , and check details with audisp -u username ; audisp -e eventname ; audisp -f for failed operations.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2005 02:06 AM
09-05-2005 02:06 AM
Re: Last commands
Auditing can be configure using audsys and audevent
#man 1m audsys and
#man 1m audevent
Cheers,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2005 05:01 PM
09-05-2005 05:01 PM
Re: Last commands
Thanks for all ur inputs and those were great. To be specific, i would like to trace the commands executed by each and everyuser with their IP address without adding the scripts on each and every users profile. Its something like the history command in solaris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2005 05:56 PM
09-05-2005 05:56 PM
Re: Last commands
-- /etc/profile --
set -o vi
export $HISTFILE=/var/.history_log
export $HISTSIZE=2000
ps | grep -q 'telnetd'
if [ $? -eq 0 ]
then
echo "Telnet sesssion logged $LOGNAME $(date)" >> $HISTFILE
echo "`who -mu` is logged" >> $HISTFILE
fi
You can audit with /var/.history_log file. If you want,you can change the location.
It will log history for all telnet based logins. If you don't want then remove telnet check and put two echo lines.
hth.