Prevent deleting files in particular directory

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











up vote
0
down vote

favorite












Recently, I deleted some files accidentally. Fortunately, I was able to recover them. That is why I would like to prevent deleting files in a particular directory but still allow to create new files and modify them. So, permissions should be rwx, but if I want to delete ANY file (created by ANY user) in this directory, I should be prompted to input a password. Is this possible somehow on Debian Testing?










share|improve this question





















  • similar question on AU How can I set up a password for the 'rm' command?, by the way you want password protect find -delete or mv * afile or any other scripting way?
    – Î±Ò“sнιη
    Oct 2 '17 at 17:03











  • I am just reading the thread you mentioned. I want to protect just the normal rm afile which I can do through the file manager. It does not have to be secure, but just prevent me from making mistakes.
    – tavkomann
    Oct 2 '17 at 17:10











  • This seems to be what I want: askubuntu.com/a/866003/692458 Is it possible to change the rm executable only in a specific directory and not everywhere?
    – tavkomann
    Oct 2 '17 at 17:19











  • see also How to prevent users from deleting a directory?.
    – Î±Ò“sнιη
    Oct 2 '17 at 17:27











  • Maybe directory protection would suffice for me. chattr +a directory also looks not bad. Is there something similar which allows me to rename and change the files?
    – tavkomann
    Oct 2 '17 at 18:03















up vote
0
down vote

favorite












Recently, I deleted some files accidentally. Fortunately, I was able to recover them. That is why I would like to prevent deleting files in a particular directory but still allow to create new files and modify them. So, permissions should be rwx, but if I want to delete ANY file (created by ANY user) in this directory, I should be prompted to input a password. Is this possible somehow on Debian Testing?










share|improve this question





















  • similar question on AU How can I set up a password for the 'rm' command?, by the way you want password protect find -delete or mv * afile or any other scripting way?
    – Î±Ò“sнιη
    Oct 2 '17 at 17:03











  • I am just reading the thread you mentioned. I want to protect just the normal rm afile which I can do through the file manager. It does not have to be secure, but just prevent me from making mistakes.
    – tavkomann
    Oct 2 '17 at 17:10











  • This seems to be what I want: askubuntu.com/a/866003/692458 Is it possible to change the rm executable only in a specific directory and not everywhere?
    – tavkomann
    Oct 2 '17 at 17:19











  • see also How to prevent users from deleting a directory?.
    – Î±Ò“sнιη
    Oct 2 '17 at 17:27











  • Maybe directory protection would suffice for me. chattr +a directory also looks not bad. Is there something similar which allows me to rename and change the files?
    – tavkomann
    Oct 2 '17 at 18:03













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Recently, I deleted some files accidentally. Fortunately, I was able to recover them. That is why I would like to prevent deleting files in a particular directory but still allow to create new files and modify them. So, permissions should be rwx, but if I want to delete ANY file (created by ANY user) in this directory, I should be prompted to input a password. Is this possible somehow on Debian Testing?










share|improve this question













Recently, I deleted some files accidentally. Fortunately, I was able to recover them. That is why I would like to prevent deleting files in a particular directory but still allow to create new files and modify them. So, permissions should be rwx, but if I want to delete ANY file (created by ANY user) in this directory, I should be prompted to input a password. Is this possible somehow on Debian Testing?







permissions password root chmod chown






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 2 '17 at 17:00









tavkomann

1035




1035











  • similar question on AU How can I set up a password for the 'rm' command?, by the way you want password protect find -delete or mv * afile or any other scripting way?
    – Î±Ò“sнιη
    Oct 2 '17 at 17:03











  • I am just reading the thread you mentioned. I want to protect just the normal rm afile which I can do through the file manager. It does not have to be secure, but just prevent me from making mistakes.
    – tavkomann
    Oct 2 '17 at 17:10











  • This seems to be what I want: askubuntu.com/a/866003/692458 Is it possible to change the rm executable only in a specific directory and not everywhere?
    – tavkomann
    Oct 2 '17 at 17:19











  • see also How to prevent users from deleting a directory?.
    – Î±Ò“sнιη
    Oct 2 '17 at 17:27











  • Maybe directory protection would suffice for me. chattr +a directory also looks not bad. Is there something similar which allows me to rename and change the files?
    – tavkomann
    Oct 2 '17 at 18:03

















  • similar question on AU How can I set up a password for the 'rm' command?, by the way you want password protect find -delete or mv * afile or any other scripting way?
    – Î±Ò“sнιη
    Oct 2 '17 at 17:03











  • I am just reading the thread you mentioned. I want to protect just the normal rm afile which I can do through the file manager. It does not have to be secure, but just prevent me from making mistakes.
    – tavkomann
    Oct 2 '17 at 17:10











  • This seems to be what I want: askubuntu.com/a/866003/692458 Is it possible to change the rm executable only in a specific directory and not everywhere?
    – tavkomann
    Oct 2 '17 at 17:19











  • see also How to prevent users from deleting a directory?.
    – Î±Ò“sнιη
    Oct 2 '17 at 17:27











  • Maybe directory protection would suffice for me. chattr +a directory also looks not bad. Is there something similar which allows me to rename and change the files?
    – tavkomann
    Oct 2 '17 at 18:03
















similar question on AU How can I set up a password for the 'rm' command?, by the way you want password protect find -delete or mv * afile or any other scripting way?
– Î±Ò“sнιη
Oct 2 '17 at 17:03





similar question on AU How can I set up a password for the 'rm' command?, by the way you want password protect find -delete or mv * afile or any other scripting way?
– Î±Ò“sнιη
Oct 2 '17 at 17:03













I am just reading the thread you mentioned. I want to protect just the normal rm afile which I can do through the file manager. It does not have to be secure, but just prevent me from making mistakes.
– tavkomann
Oct 2 '17 at 17:10





I am just reading the thread you mentioned. I want to protect just the normal rm afile which I can do through the file manager. It does not have to be secure, but just prevent me from making mistakes.
– tavkomann
Oct 2 '17 at 17:10













This seems to be what I want: askubuntu.com/a/866003/692458 Is it possible to change the rm executable only in a specific directory and not everywhere?
– tavkomann
Oct 2 '17 at 17:19





This seems to be what I want: askubuntu.com/a/866003/692458 Is it possible to change the rm executable only in a specific directory and not everywhere?
– tavkomann
Oct 2 '17 at 17:19













see also How to prevent users from deleting a directory?.
– Î±Ò“sнιη
Oct 2 '17 at 17:27





see also How to prevent users from deleting a directory?.
– Î±Ò“sнιη
Oct 2 '17 at 17:27













Maybe directory protection would suffice for me. chattr +a directory also looks not bad. Is there something similar which allows me to rename and change the files?
– tavkomann
Oct 2 '17 at 18:03





Maybe directory protection would suffice for me. chattr +a directory also looks not bad. Is there something similar which allows me to rename and change the files?
– tavkomann
Oct 2 '17 at 18:03











1 Answer
1






active

oldest

votes

















up vote
1
down vote













You can do that with aufs / unionfs. You put the files which are to be protected in the read-only level.



Real file deletion could be realized with password protection by having the read-only directory in



/path/to/ro


with ro belonging to a special user and having 755 permissions. Deletions could be done with sudo then:



sudo -u rmuser rm /path/to/ro/file





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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f395691%2fprevent-deleting-files-in-particular-directory%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    You can do that with aufs / unionfs. You put the files which are to be protected in the read-only level.



    Real file deletion could be realized with password protection by having the read-only directory in



    /path/to/ro


    with ro belonging to a special user and having 755 permissions. Deletions could be done with sudo then:



    sudo -u rmuser rm /path/to/ro/file





    share|improve this answer
























      up vote
      1
      down vote













      You can do that with aufs / unionfs. You put the files which are to be protected in the read-only level.



      Real file deletion could be realized with password protection by having the read-only directory in



      /path/to/ro


      with ro belonging to a special user and having 755 permissions. Deletions could be done with sudo then:



      sudo -u rmuser rm /path/to/ro/file





      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        You can do that with aufs / unionfs. You put the files which are to be protected in the read-only level.



        Real file deletion could be realized with password protection by having the read-only directory in



        /path/to/ro


        with ro belonging to a special user and having 755 permissions. Deletions could be done with sudo then:



        sudo -u rmuser rm /path/to/ro/file





        share|improve this answer












        You can do that with aufs / unionfs. You put the files which are to be protected in the read-only level.



        Real file deletion could be realized with password protection by having the read-only directory in



        /path/to/ro


        with ro belonging to a special user and having 755 permissions. Deletions could be done with sudo then:



        sudo -u rmuser rm /path/to/ro/file






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 2 '17 at 20:25









        Hauke Laging

        53.7k1282130




        53.7k1282130



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395691%2fprevent-deleting-files-in-particular-directory%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

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

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?