How to make new files inherit permissions of parent directory in macOS?
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
add a comment |
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
add a comment |
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
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
bash mac permissions
edited Feb 1 at 1:45
blamesystemd
asked Jan 27 at 2:58
blamesystemdblamesystemd
312
312
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jan 30 at 20:54
Ljm DullaartLjm Dullaart
72528
72528
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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