Auditing script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Auditing script
# 1  
Old 04-14-2011
Auditing script

I need a command line that will ls -l a directory and pick (grep?) all files that don't match a desired owner without losing track of the filename at any point. This way I can list later on "here are all the files with an incorrect owner". Thanks in advance
# 2  
Old 04-14-2011
Is this what you want:

Code:
ls -l | egrep -v 'user_name'

# 3  
Old 04-14-2011
The find command can do what you want, pretty sure.

Code:
$ find /path/to/dir/ '!' -user validuser
/path/to/dir/inside/filenotbelongingtovaliduser
...
$

This User Gave Thanks to Corona688 For This Post:
# 4  
Old 04-14-2011
What if you have a filename with the same name as the desired owner but has a different owner?

It would be nice if grep would only scan the owners column and ignore the rest, how to do this?

---------- Post updated at 09:16 AM ---------- Previous update was at 09:14 AM ----------

Thanks Corona that may be exactly what I'm looking for.
# 5  
Old 04-14-2011
Quote:
Originally Posted by stevensw
What if you have a filename with the same name as the desired owner but has a different owner?
If I understand you:

Code:
USERNAME="qwerty"
# finds files named ${USERNAME} exactly.
# if you want to broaden it, you can use glob-like *, etc (inside the quotes!)
# Only matches if the username is NOT ${USERNAME}.
find /path -name "${USERNAME}" '!' -user "$USERNAME"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help to write a shell script for auditing

var/log/secure provides us below information : Mar 20 08:07:07 testing sshd: Accepted password for oracle from 10.51.1.12 port 49239 ssh2 Mar 20 08:07:07 testing sshd: pam_unix(sshd:session): session opened for user oracle by (uid=0) Mar 20 08:12:16 testing sshd: Received disconnect from... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

2. AIX

AIX auditing

can some give some tips, most common security issues or and kind of advice about auditing aix system? regards (2 Replies)
Discussion started by: bongo
2 Replies

3. AIX

AIX auditing

I have a question relating with AIX auditing Question is can we set Auditing on a particular file in AIX for a particular application only? Let say I have a file name "info.jar" and I have three application named APP1, APP2 & APP3 which are accessing that file so I want to know that which... (0 Replies)
Discussion started by: m_raheelahmed
0 Replies

4. Shell Programming and Scripting

user auditing

Hello, is there some way to track what shell commands some user is executing ? Something like to have some log file where i could see what commands some user used, e.g. rm -r dirname , ls -l .... and so on ... I have 2.6.13-1.1526_FC4smp (9 Replies)
Discussion started by: tonijel
9 Replies

5. Shell Programming and Scripting

Script for Oracle user activity auditing

Hi All, I need to put in place a UNIX shell script that calls three sql scripts & reports to the DBAs. I already have the three sql scripts in place & they perform the following database auditing actions: 1. actions.sql This script queries the DBA_AUDIT _TRAIL table to look for database user... (2 Replies)
Discussion started by: divroro12
2 Replies

6. AIX

Auditing events

Hi there, I want to enable auditing for the following events in a critical AIX UNIX server by editing the /etc/syslog.conf file: Authentication events (login success, login failure, logout) Privilege use events (change to another user etc.) ... (1 Reply)
Discussion started by: venksel
1 Replies

7. UNIX for Advanced & Expert Users

Auditing

:)I need a little help. I have sent all of our logs to our log server, but I can't send the audit logs that are in /var/log/audit.log. Can someone give me some type of idea to transfer these logs. Thank You (2 Replies)
Discussion started by: aojmoj
2 Replies

8. UNIX for Dummies Questions & Answers

File auditing

Hello everbody: I have a file on the system, I need to check who was the last user who accessed or modified it, and if i can get any further details i can get like IP or access time,etc. do you have any idea about simple concept or way i can do that in unix tru64 or solaris 9? thanks in advance... (2 Replies)
Discussion started by: aladdin
2 Replies

9. AIX

User Auditing

i want to audit user commands .. keep track of what commands each user has been giving .. can this be done by writing a script in engraving it in .profile of the user. or is there any other way of doing this ... rgds raj (2 Replies)
Discussion started by: rajesh_149
2 Replies

10. UNIX for Advanced & Expert Users

Question about Auditing

I was just going thru the auditing script .. 2 questions pop in mind .. Why did they move S81volmgmt .. What is the logic behind not loading it .. 2) Why the purpose of the device allocate entries (2 Replies)
Discussion started by: DPAI
2 Replies
Login or Register to Ask a Question