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

前端 未结 13 1332
逝去的感伤
逝去的感伤 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:02

    you can get the file's permissions with

    ls -l | awk '{print $1" "$NF}'
    

    which will return a list of file names and their permissions. save it somewhere, and once you're done - restore (chmod) each file's permissions.

提交回复
热议问题