Execute Bit For Folders But Not Files












0















I have a folder called Movies with sub-folders called Movie1, Movie2 etc, and then the movie inside of that sub-directory. Example below:



 Movies:
Movie1
film.whatever1
Movie2
film.whatever1
Movie3
film.whatever1
Movie4
film.whatever1
Movie5
film.whatever1


I want the permissions to be 755 for directories so that anyone can navigate down to Movie1-5 folders (the only reason this is 755 and not 744 is because the execute bit is required to change into a directory). But I want all the film.whatever1-5 files to be read-only. I cannot for the life of me figure out if that's possible.



I tried to do this using the setfacl command with the upper case X as shown below:



 setfacl -R -d -m u::rwx Movies
setfacl -R -d -m g::r-X Movies
setfacl -R -d -m o::r-X Movies

setfacl -R -m u::rwx Movies
setfacl -R -m g::r-X Movies
setfacl -R -m o::r-X Movies


The result was that it changed the folder and files to BOTH be executable. It's a very annoying problem I need to solve.










share|improve this question























  • AFAIK the X in a setfacl mode description (same as chmod) means "execute only if the file is a directory or already has execute permission for some user" - it doesn't remove execute permission from non-directories that already have it.

    – steeldriver
    Feb 3 at 18:11
















0















I have a folder called Movies with sub-folders called Movie1, Movie2 etc, and then the movie inside of that sub-directory. Example below:



 Movies:
Movie1
film.whatever1
Movie2
film.whatever1
Movie3
film.whatever1
Movie4
film.whatever1
Movie5
film.whatever1


I want the permissions to be 755 for directories so that anyone can navigate down to Movie1-5 folders (the only reason this is 755 and not 744 is because the execute bit is required to change into a directory). But I want all the film.whatever1-5 files to be read-only. I cannot for the life of me figure out if that's possible.



I tried to do this using the setfacl command with the upper case X as shown below:



 setfacl -R -d -m u::rwx Movies
setfacl -R -d -m g::r-X Movies
setfacl -R -d -m o::r-X Movies

setfacl -R -m u::rwx Movies
setfacl -R -m g::r-X Movies
setfacl -R -m o::r-X Movies


The result was that it changed the folder and files to BOTH be executable. It's a very annoying problem I need to solve.










share|improve this question























  • AFAIK the X in a setfacl mode description (same as chmod) means "execute only if the file is a directory or already has execute permission for some user" - it doesn't remove execute permission from non-directories that already have it.

    – steeldriver
    Feb 3 at 18:11














0












0








0








I have a folder called Movies with sub-folders called Movie1, Movie2 etc, and then the movie inside of that sub-directory. Example below:



 Movies:
Movie1
film.whatever1
Movie2
film.whatever1
Movie3
film.whatever1
Movie4
film.whatever1
Movie5
film.whatever1


I want the permissions to be 755 for directories so that anyone can navigate down to Movie1-5 folders (the only reason this is 755 and not 744 is because the execute bit is required to change into a directory). But I want all the film.whatever1-5 files to be read-only. I cannot for the life of me figure out if that's possible.



I tried to do this using the setfacl command with the upper case X as shown below:



 setfacl -R -d -m u::rwx Movies
setfacl -R -d -m g::r-X Movies
setfacl -R -d -m o::r-X Movies

setfacl -R -m u::rwx Movies
setfacl -R -m g::r-X Movies
setfacl -R -m o::r-X Movies


The result was that it changed the folder and files to BOTH be executable. It's a very annoying problem I need to solve.










share|improve this question














I have a folder called Movies with sub-folders called Movie1, Movie2 etc, and then the movie inside of that sub-directory. Example below:



 Movies:
Movie1
film.whatever1
Movie2
film.whatever1
Movie3
film.whatever1
Movie4
film.whatever1
Movie5
film.whatever1


I want the permissions to be 755 for directories so that anyone can navigate down to Movie1-5 folders (the only reason this is 755 and not 744 is because the execute bit is required to change into a directory). But I want all the film.whatever1-5 files to be read-only. I cannot for the life of me figure out if that's possible.



I tried to do this using the setfacl command with the upper case X as shown below:



 setfacl -R -d -m u::rwx Movies
setfacl -R -d -m g::r-X Movies
setfacl -R -d -m o::r-X Movies

setfacl -R -m u::rwx Movies
setfacl -R -m g::r-X Movies
setfacl -R -m o::r-X Movies


The result was that it changed the folder and files to BOTH be executable. It's a very annoying problem I need to solve.







permissions acl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 3 at 16:22









john smithjohn smith

1,05642040




1,05642040













  • AFAIK the X in a setfacl mode description (same as chmod) means "execute only if the file is a directory or already has execute permission for some user" - it doesn't remove execute permission from non-directories that already have it.

    – steeldriver
    Feb 3 at 18:11



















  • AFAIK the X in a setfacl mode description (same as chmod) means "execute only if the file is a directory or already has execute permission for some user" - it doesn't remove execute permission from non-directories that already have it.

    – steeldriver
    Feb 3 at 18:11

















AFAIK the X in a setfacl mode description (same as chmod) means "execute only if the file is a directory or already has execute permission for some user" - it doesn't remove execute permission from non-directories that already have it.

– steeldriver
Feb 3 at 18:11





AFAIK the X in a setfacl mode description (same as chmod) means "execute only if the file is a directory or already has execute permission for some user" - it doesn't remove execute permission from non-directories that already have it.

– steeldriver
Feb 3 at 18:11










1 Answer
1






active

oldest

votes


















2














You can use find to run different commands on regular files and directories by filtering them with the -type option. This runs recursively on everything inside ./Movies:



# all directories become 755 (rwx r-x r-x):
find ./Movies -type d -exec chmod 755 '{}' ;

# all files become 644 (rw- r-- r--):
find ./Movies -type f -exec chmod 644 '{}' ;





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f1115288%2fexecute-bit-for-folders-but-not-files%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









    2














    You can use find to run different commands on regular files and directories by filtering them with the -type option. This runs recursively on everything inside ./Movies:



    # all directories become 755 (rwx r-x r-x):
    find ./Movies -type d -exec chmod 755 '{}' ;

    # all files become 644 (rw- r-- r--):
    find ./Movies -type f -exec chmod 644 '{}' ;





    share|improve this answer




























      2














      You can use find to run different commands on regular files and directories by filtering them with the -type option. This runs recursively on everything inside ./Movies:



      # all directories become 755 (rwx r-x r-x):
      find ./Movies -type d -exec chmod 755 '{}' ;

      # all files become 644 (rw- r-- r--):
      find ./Movies -type f -exec chmod 644 '{}' ;





      share|improve this answer


























        2












        2








        2







        You can use find to run different commands on regular files and directories by filtering them with the -type option. This runs recursively on everything inside ./Movies:



        # all directories become 755 (rwx r-x r-x):
        find ./Movies -type d -exec chmod 755 '{}' ;

        # all files become 644 (rw- r-- r--):
        find ./Movies -type f -exec chmod 644 '{}' ;





        share|improve this answer













        You can use find to run different commands on regular files and directories by filtering them with the -type option. This runs recursively on everything inside ./Movies:



        # all directories become 755 (rwx r-x r-x):
        find ./Movies -type d -exec chmod 755 '{}' ;

        # all files become 644 (rw- r-- r--):
        find ./Movies -type f -exec chmod 644 '{}' ;






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 3 at 16:31









        Byte CommanderByte Commander

        65.1k27178300




        65.1k27178300






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f1115288%2fexecute-bit-for-folders-but-not-files%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

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido