Normally, we use chmod
,chown
,and SUID
, SGID
,Sticky bit
to set permission
,owner
in Centos.
Now, I need to backup folders /var/www
and files owner and permission, and restore to git deploy server.
My bash shell script as below:
getfacl -apR /var/www > acl_backup
setfacl -n --restore=acl_backup
As ACL
has some particular control mode and will override POSIX control mode, I should avoid my files and folders be infected by additional control,just exactly keep the same owner and permission. Which means,neither more nor less, I just want my files and folders has exactly same owner and permission after setfacl --restore
.
How to use getfacl and setfacl to backup and exactly restore files and folders POSIX permission and owner?