Is it possible to create a script to save and restore permissions?

前端 未结 13 1331
逝去的感伤
逝去的感伤 2021-01-30 04:29

I am using a linux system and need to experiment with some permissions on a set of nested files and directories. I wonder if there is not some way to save the permissions for t

13条回答
  •  不思量自难忘°
    2021-01-30 05:03

    Install the ACL package first:

    sudo apt-get install acl
    

    Recursively store permissions and ownership to file:

    getfacl -R yourDirectory > permissions.acl
    

    Restore (relative to current path):

    setfacl --restore=permissions.acl
    

提交回复
热议问题