1

I want to find a solution to backup,restore,compare permissions.

At first, I can use getfacl and setfacl,but output of this method is not ordered.example
Then, I tried this method,but output is one line string,hard to compare to find the difference.

Is there any solution to backup/restore,and compare folders and files permissions?

kittygirl
  • 2,255
  • 5
  • 24
  • 52

1 Answers1

0

If anything can be improved,such as add print0,pls comment or create a new answer.

find * -depth -exec stat --format '%a %U %G %n' {} + > ../repo/all_folders_files_permission

while read PERMS OWNER GROUP FILE
do
    chmod "$PERMS" "$FILE"
    chown "${OWNER}:${GROUP}" "$FILE"
done < ../repo/all_folders_files_permission
kittygirl
  • 2,255
  • 5
  • 24
  • 52