Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Just as it sounds, I'm trying to find out if there is a (standard) command that will produce a diff of the permissions between two files and/or directory trees.

Ideally it would put out a patch file that could be used to change permissions to match the target, though I'm guessing since standard patch files are interpreted by ed, that it might have to be a separate format.

share|improve this question
add comment

1 Answer

You could always do something like this to get the differences.

diff -u <( cd path1 ; find . -printf "chown %U:%G %p; chmod %m %p \n" | sort ) \
        <( cd path2 ; find . -printf "chown %U:%G %p; chmod %m %p \n" | sort )

It would then be trivial to hack up something that performs the require changes.

share|improve this answer
    
The problem then would be that the patch script would need to be on the target system. It could all be baked into a single script, but people tend to get a little antsy about being asked to run an executable. –  Catskul Jun 20 '12 at 23:43
1  
Sorry, but I don't know what you are talking about. What do you mean by target system? Perhaps you need to update your question with more details about what you are doing. –  Zoredache Jun 21 '12 at 0:55
    
A patch eventually has to be applied, and often times it's on another system. If custom tools are used those have to be passed to the other system to apply the ownership patch. Clearly not a big deal; but less optimal than if there was a standard way to do it. –  Catskul Jun 21 '12 at 14:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.