LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-07-2015, 02:32 PM   #1
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Attempting to capture all SUDO commands


Hello I am trying to capture all commands that someone who either uses 'sudo' or 'su -' to root uses. I have the following in my .baschrc file in root;

Code:
export HISTSIZE=10000
export HISTTIMEFORMAT="%F %T "
export HISTFILE=/var/log/users_historylogs/root_history-$(who am i | awk '{print $1}';exit)
export PROMPT_COMMAND='history -a'
Checking the history file I see this;

Code:
#1428434081
cat /var/log/users_historylogs/root_history-rjs
#1428434220
vi .bashrc
#1428434289
source .bashrc
#1428434292
cat /var/log/users_historylogs/root_history-rjs
#1428434391
vi .bashrc
#1428434569
source .bashrc
#1428434572
ls
As you can see I am not seeing what I would like to see and that would be the foramt of;

20150407 15:33

Or even better

20150407 1533

What is the above not working and how can I fix this?
 
Old 04-07-2015, 03:08 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
and if you type 'history' is it not displayed as you expect?
 
Old 04-07-2015, 04:07 PM   #3
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
I think you referred this post to configure this: http://sharadchhetri.com/2011/12/02/...ndary-logging/

However, you forgot to read the comments below Those are the epoch values what you see, author has mentioned the way to rectify the format in the comments section. Here is the abstract from it:

Code:
export PATH
export HISTSIZE=10000
export HISTTIMEFORMAT="%F %T "
export HISTFILE=/var/log/users_historylogs/root_history-$(who am i | awk '{print $1}';exit)-`date +%F`
export PROMPT_COMMAND='history -a;date >> $HISTFILE'
 
Old 04-07-2015, 07:43 PM   #4
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249

Original Poster
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
All fixed, thanks T3RM1NVT0R.
 
Old 04-08-2015, 01:39 AM   #5
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You're welcome and thanks for marking thread as solved.

Enjoy Linux!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to know all commands available from Sudo? Xeratul Linux - Newbie 5 11-03-2012 11:25 AM
Using Commands over SSH using Sudo metallica1973 General 11 02-21-2012 12:05 PM
[SOLVED] Allow commands without SUDO Touch Linux - Newbie 6 01-05-2011 08:33 AM
[SOLVED] Capture a list of all installed commands worm5252 Linux - Newbie 7 01-30-2010 05:26 PM
sudo and at commands ulto Programming 2 05-01-2004 08:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration