Here is a tip on how to backup file permissions in Linux using getfacl. This is very useful technique if you want to prevent someone or you to change file permissions of certain set of files or directories. By using a getfacl command we can take a snapshot of file permissions :

getfacl -R /var/www/myweb > permissions.acl

This will backup permissions of all files and directories within /var/www/myweb and myweb directory itself. -R ensures that the /var/www/myweb will be traversed recursively to include all files and directories.

Now, that we have set of permissions stored in a single file permissions.acl we can restore them by:

setfacl --restore=permissions.acl

Since file permissions.acl contains a full path to all files and directories within /var/www/myweb there is no need to specify where a path to where permissions should be restored.

Free Linux eBooks

Linux Technical Writer

LinuxCareer, Casual, Volunteer, Home Based

Do you wish to join Linuxcareer.com project and find out how to be a technical writer? We are now looking for volunteers to help us write tutorials and share them with Linux community

  • Casual work from home
  • 10 articles / year

Any active Linuxcareer.com’s author will be entitled to following benefits:

  • actively participate in Linuxcareer.com’s decision making process
  • feedback and help

APPLY

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top