Date Modified Tags Linux

So for a personal project I am working on, I recently had a problem I was encountering where a process I was running was causing my file permissions for a large sequence of files and folders to be rewritten. The rewritten permissions were causing some issues and so I rolled back the VPS to a backup from the prior day.

After doing some investigations, I thought I had found the issue and was ready to restart the process. I started wondering though if there was a way to easily save all the permissions of everything in a folder to a file, and then later restore from that file. I could think of a way to write a script to do this, but I didn't have time to go off on a tangent and start a new project!

I did some searching and came across this very cool tool!

Install acl

First you will need to install acl on your machine, if it is not already there. On an Ubuntu machine you can do this with:

sudo apt-get install acl

Save the permissions to a file

getfacl -R myFolder/ > permissions.acl

Restore the permissions from the file

setfacl --restore=permissions.acl

As usual, feel free to contact me if you come across any errors in this post!


comments powered by Disqus