LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2014, 07:18 AM   #1
prabhakar1234
LQ Newbie
 
Registered: Jul 2014
Posts: 2

Rep: Reputation: Disabled
Unhappy track and log user activity in linux


dear all ,



Actually i want to keep track of all the commands executed in a bash prompt of users ,
very much in same manner as it is displayed when we run "history" command.

now the users are smart enough as they delete their history by "history -c".

my motive is to get the command exactly in same manner as it was executed

E.g: -- Someuser typed "rm -rf Impfile.txt"

Then i need exactly the same syntax ----> "rm -rf Impfile.txt" with user name in syslog to keep the track record .


or is their any linux utility which will log all user activity in syslog

I have googled a lot for this but didn't find any satisfactory answer.

I know there must be some solution to this that is why I am posting in this forum as many linux experts are on this forum.

Thanx in Advance
 
Old 07-07-2014, 07:50 AM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,181

Rep: Reputation: 243Reputation: 243Reputation: 243
Quote:
now the users are smart enough as they delete their history by "history -c".
Why would they do this?

Anyway, what's to stop them writing some of their commands as bash scripts?

One possibility is to change their command entry prompt so as to pre-execute a short script which takes any parameter string passed in (a command) and logs it to syslog before passing it on to bash to be executed.

If you just want to hide a few commands try looking at the alias command.
 
Old 07-07-2014, 09:50 AM   #3
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,573
Blog Entries: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by prabhakar1234 View Post
I have googled a lot for this but didn't find any satisfactory answer.
I wonder what you googled for, exactly.
GIGO...
I literally searched for the topic of this thread at google.com and found 1.7 Million hits.
I find it hard to believe that none are "satisfactory"

Good Luck.

Edit: JeremyBoden has a valid point, eg. shell scripts.
Script running will be recorded, but not the commands in them.
Changing shells is also a bypass option.
or commands prefaced with a <space> in the bash shell.

You have to be smarter than your users and 5 years since an identical word-for-word post here (Thanks Google)

I feel very sad, if that's your post as well.

Last edited by Habitual; 07-07-2014 at 10:01 AM.
 
Old 07-07-2014, 05:50 PM   #4
${i}
LQ Newbie
 
Registered: Jul 2014
Posts: 22

Rep: Reputation: 9
Quote:
Originally Posted by prabhakar1234 View Post
is their any linux utility which will log all user activity in syslog

I have googled a lot for this but didn't find any satisfactory answer.

I know there must be some solution to this that is why I am posting in this forum as many linux experts are on this forum.

Thanx in Advance
What you need is called process accounting -- it logs users activities including commands they type.

Read the tutorial here
http://www.tecmint.com/how-to-monito...or-acct-tools/

I hope this is what you are looking for
 
Old 07-07-2014, 07:12 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Over the years I've made quite a few posts I think about logging. This one for example should give enough pointers to get you started. psacct BTW doesn't cut it if you require a more extensive audit trail but Rootsh definitely helps. (*BTW searching LQ helps, at least one of my posts on Rooths precedes the unix.com one by 3 years ;-p)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
User router activity Log Analyzer raman36127 Linux - Security 2 02-13-2013 01:40 PM
[SOLVED] Log user login/logout and activity gacanepa Linux - Newbie 1 09-10-2012 03:06 PM
User activity Log in RHEL 5.2 it_guy Red Hat 9 05-05-2011 06:47 AM
trying to track http activity specifically whysyn Linux - Security 1 12-07-2007 12:32 AM
Keep track of logs to find suspicious activity leosgb Linux - Security 3 03-04-2006 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:55 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration