Protect overwriting folder content

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?










share|improve this question
























  • Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.

    – RoVo
    Jan 23 at 13:40
















2















Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?










share|improve this question
























  • Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.

    – RoVo
    Jan 23 at 13:40














2












2








2








Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?










share|improve this question
















Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?







linux permissions acl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 23 at 14:40









Jeff Schaller

41.2k1056131




41.2k1056131










asked Jan 23 at 13:04









Slim OntarioSlim Ontario

111




111












  • Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.

    – RoVo
    Jan 23 at 13:40


















  • Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.

    – RoVo
    Jan 23 at 13:40

















Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.

– RoVo
Jan 23 at 13:40






Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.

– RoVo
Jan 23 at 13:40











1 Answer
1






active

oldest

votes


















1














One might use inotifywait to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools.



Create a script, perhaps /usr/local/sbin/inbox.sh, as follows.



#!/usr/bin/env bash
inotifywait -m -e create "/path/to/directory" |
while read path event file; do
if [ "$event" = "CREATE" ]; then
chown root:root "$path$file"
fi
done


Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh). Then run it at boot time from, say, /etc/rc.local or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &.



According to the manual, -m monitors indefinitely, and -e watches for a specific event. Within the while loop, it could be possible to receive an event such as CREATE,ISDIR, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if statement contains a command to respond only to new files, which are represented with the event, CREATE. The path variable from inotifywait has a trailing slash character, so $path and $file can be concatenated without specifying a slash between the two.






share|improve this answer
























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496212%2fprotect-overwriting-folder-content%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    One might use inotifywait to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools.



    Create a script, perhaps /usr/local/sbin/inbox.sh, as follows.



    #!/usr/bin/env bash
    inotifywait -m -e create "/path/to/directory" |
    while read path event file; do
    if [ "$event" = "CREATE" ]; then
    chown root:root "$path$file"
    fi
    done


    Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh). Then run it at boot time from, say, /etc/rc.local or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &.



    According to the manual, -m monitors indefinitely, and -e watches for a specific event. Within the while loop, it could be possible to receive an event such as CREATE,ISDIR, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if statement contains a command to respond only to new files, which are represented with the event, CREATE. The path variable from inotifywait has a trailing slash character, so $path and $file can be concatenated without specifying a slash between the two.






    share|improve this answer





























      1














      One might use inotifywait to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools.



      Create a script, perhaps /usr/local/sbin/inbox.sh, as follows.



      #!/usr/bin/env bash
      inotifywait -m -e create "/path/to/directory" |
      while read path event file; do
      if [ "$event" = "CREATE" ]; then
      chown root:root "$path$file"
      fi
      done


      Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh). Then run it at boot time from, say, /etc/rc.local or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &.



      According to the manual, -m monitors indefinitely, and -e watches for a specific event. Within the while loop, it could be possible to receive an event such as CREATE,ISDIR, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if statement contains a command to respond only to new files, which are represented with the event, CREATE. The path variable from inotifywait has a trailing slash character, so $path and $file can be concatenated without specifying a slash between the two.






      share|improve this answer



























        1












        1








        1







        One might use inotifywait to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools.



        Create a script, perhaps /usr/local/sbin/inbox.sh, as follows.



        #!/usr/bin/env bash
        inotifywait -m -e create "/path/to/directory" |
        while read path event file; do
        if [ "$event" = "CREATE" ]; then
        chown root:root "$path$file"
        fi
        done


        Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh). Then run it at boot time from, say, /etc/rc.local or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &.



        According to the manual, -m monitors indefinitely, and -e watches for a specific event. Within the while loop, it could be possible to receive an event such as CREATE,ISDIR, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if statement contains a command to respond only to new files, which are represented with the event, CREATE. The path variable from inotifywait has a trailing slash character, so $path and $file can be concatenated without specifying a slash between the two.






        share|improve this answer















        One might use inotifywait to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools.



        Create a script, perhaps /usr/local/sbin/inbox.sh, as follows.



        #!/usr/bin/env bash
        inotifywait -m -e create "/path/to/directory" |
        while read path event file; do
        if [ "$event" = "CREATE" ]; then
        chown root:root "$path$file"
        fi
        done


        Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh). Then run it at boot time from, say, /etc/rc.local or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &.



        According to the manual, -m monitors indefinitely, and -e watches for a specific event. Within the while loop, it could be possible to receive an event such as CREATE,ISDIR, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if statement contains a command to respond only to new files, which are represented with the event, CREATE. The path variable from inotifywait has a trailing slash character, so $path and $file can be concatenated without specifying a slash between the two.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 23 at 20:07

























        answered Jan 23 at 16:44









        ChristopherChristopher

        10.4k33148




        10.4k33148



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496212%2fprotect-overwriting-folder-content%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay