How to make new files inherit permissions of parent directory in macOS?












0















I have a directory python-work for my python(3) work. I create a new file test.py. This file will simply print('hello world').



Trying to run the new file:



{mac name}:python-work user$ ./test.py 
-bash: ./test.py: Permission denied


A fix is to individually adjust permissions with chmod +x ./test.py.



{mac name}:python-work user$ ./test.py 
hello world


How can I ensure that any new files created within this folder inherit the executable permission from its parent directory, rather than having to individually adjust permissions for each new file?



I would like to acknowledge this similar question, which did not solve my issue.










share|improve this question





























    0















    I have a directory python-work for my python(3) work. I create a new file test.py. This file will simply print('hello world').



    Trying to run the new file:



    {mac name}:python-work user$ ./test.py 
    -bash: ./test.py: Permission denied


    A fix is to individually adjust permissions with chmod +x ./test.py.



    {mac name}:python-work user$ ./test.py 
    hello world


    How can I ensure that any new files created within this folder inherit the executable permission from its parent directory, rather than having to individually adjust permissions for each new file?



    I would like to acknowledge this similar question, which did not solve my issue.










    share|improve this question



























      0












      0








      0


      1






      I have a directory python-work for my python(3) work. I create a new file test.py. This file will simply print('hello world').



      Trying to run the new file:



      {mac name}:python-work user$ ./test.py 
      -bash: ./test.py: Permission denied


      A fix is to individually adjust permissions with chmod +x ./test.py.



      {mac name}:python-work user$ ./test.py 
      hello world


      How can I ensure that any new files created within this folder inherit the executable permission from its parent directory, rather than having to individually adjust permissions for each new file?



      I would like to acknowledge this similar question, which did not solve my issue.










      share|improve this question
















      I have a directory python-work for my python(3) work. I create a new file test.py. This file will simply print('hello world').



      Trying to run the new file:



      {mac name}:python-work user$ ./test.py 
      -bash: ./test.py: Permission denied


      A fix is to individually adjust permissions with chmod +x ./test.py.



      {mac name}:python-work user$ ./test.py 
      hello world


      How can I ensure that any new files created within this folder inherit the executable permission from its parent directory, rather than having to individually adjust permissions for each new file?



      I would like to acknowledge this similar question, which did not solve my issue.







      bash mac permissions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 1 at 1:45







      blamesystemd

















      asked Jan 27 at 2:58









      blamesystemdblamesystemd

      312




      312






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The simple answer is: you can't.



          New files are created with your umask, and not by inheriting permissions from an upper level.



          There is a conceptual problem with inheriting permissions from the directory as well. Being executable for a directory means something different than being executable for a file. If you want to cd to a directory, that directory must be executable for you. In your inheritance proposition, it would automatically mean that all the files that you create would be executable if you are able to cd to that directory.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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%2fsuperuser.com%2fquestions%2f1398851%2fhow-to-make-new-files-inherit-permissions-of-parent-directory-in-macos%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









            0














            The simple answer is: you can't.



            New files are created with your umask, and not by inheriting permissions from an upper level.



            There is a conceptual problem with inheriting permissions from the directory as well. Being executable for a directory means something different than being executable for a file. If you want to cd to a directory, that directory must be executable for you. In your inheritance proposition, it would automatically mean that all the files that you create would be executable if you are able to cd to that directory.






            share|improve this answer




























              0














              The simple answer is: you can't.



              New files are created with your umask, and not by inheriting permissions from an upper level.



              There is a conceptual problem with inheriting permissions from the directory as well. Being executable for a directory means something different than being executable for a file. If you want to cd to a directory, that directory must be executable for you. In your inheritance proposition, it would automatically mean that all the files that you create would be executable if you are able to cd to that directory.






              share|improve this answer


























                0












                0








                0







                The simple answer is: you can't.



                New files are created with your umask, and not by inheriting permissions from an upper level.



                There is a conceptual problem with inheriting permissions from the directory as well. Being executable for a directory means something different than being executable for a file. If you want to cd to a directory, that directory must be executable for you. In your inheritance proposition, it would automatically mean that all the files that you create would be executable if you are able to cd to that directory.






                share|improve this answer













                The simple answer is: you can't.



                New files are created with your umask, and not by inheriting permissions from an upper level.



                There is a conceptual problem with inheriting permissions from the directory as well. Being executable for a directory means something different than being executable for a file. If you want to cd to a directory, that directory must be executable for you. In your inheritance proposition, it would automatically mean that all the files that you create would be executable if you are able to cd to that directory.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 30 at 20:54









                Ljm DullaartLjm Dullaart

                72528




                72528






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1398851%2fhow-to-make-new-files-inherit-permissions-of-parent-directory-in-macos%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

                    Plaza Victoria

                    Brian Clough

                    Cáceres