0

Version: 20.04 LTS

How can I force all files inside a folder to have a default set of permissions regardless of if they were created there or not? I've viewed and tried different answers mostly with ACLs, but this works only if the file was originally created in that folder, while I would like it to work even for copied/downloaded files.

2
  • You cannot do that for files coming from elsewhere. You will need to explicitly change the permissions, manually or through a script. A script can be triggered if something changes in a folder. See man inotify.
    – vanadium
    Feb 5, 2021 at 7:41
  • Any question should always include the version of Ubuntu you are using. Please edit the question or add a flag. What version is it? It is possible the version affects the answer.
    – David
    Feb 5, 2021 at 8:32

1 Answer 1

1

Solved. I used the following inotify script to reset permissions:

inotifywait -m /path/to/download/folder -e create -e moved_to -r |
while read dir action file; do
    chmod 755 $dir$file 
done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .