Operating System - HP-UX
1748180 Members
3797 Online
108759 Solutions
New Discussion юеВ

How can root can check and compare two machine files' ownership/group/permissions?

 
bin lu_1
Advisor

How can root can check and compare two machine files' ownership/group/permissions?

we have a program directory in both production and testing machines.

we rsync the files under /mflive/prog/LOAD01 and its subdir each night.
Sometimes, a file may change ownership/group/permissions during the day.

How can root can check and compare two machine files' ownership/group/permissions (a script)?

ls -R /mflive/prog/LOAD01

We have remsh or rcp could ship files between these two servers.

Thanks,

3 REPLIES 3
Mel Burslan
Honored Contributor

Re: How can root can check and compare two machine files' ownership/group/permissions?

on both machines, run an

ls -l >/tmp/files.`hostname`

command.

Then consolidate these files on one side then run them against a diff command

e.g.

diff files.host1 files.host2

it will give you an output of lines with different contents. Since your file size is not changing (hopefully) it will show you the ones with modified permissions/ownerships and modification times.

you can process these files with awk to get only the info you want if necessary

HTH
________________________________
UNIX because I majored in cryptology...
Rick Garland
Honored Contributor

Re: How can root can check and compare two machine files' ownership/group/permissions?

A shell script would be sufficient to alert to the changes. You have an established baseline and subsequent searches check the files against the established baseline. If there are differences then send an alert of some kind.

There are some applications that can be configured to search where you want. Example, tripwire can be configured to search a user-specified directory and report changes.

Other applications available as shareware/freeware. Check www.google.com
bin lu_1
Advisor

Re: How can root can check and compare two machine files' ownership/group/permissions?

Burslan,

Thank you. There are several levels of subdirectories. This works.

Thanks,

Bin