Required permission to create directory

Clash Royale CLAN TAG#URR8PPP
I'm trying to create a sub directory under existing directory tree. I want to know if only the permissions of directory where I'll be creating my sub directory matter or the parent directories will also have some effect on the permission to create the directory?
I'll be doing this programmatically, so I need to be sure that I have covered a wide range of scenarios.
files permissions filesystems
add a comment |
I'm trying to create a sub directory under existing directory tree. I want to know if only the permissions of directory where I'll be creating my sub directory matter or the parent directories will also have some effect on the permission to create the directory?
I'll be doing this programmatically, so I need to be sure that I have covered a wide range of scenarios.
files permissions filesystems
1
Why don't you try it? Create different directories with different permissions and see how they effect your ability to create a sub-directory. Should take you a few minutes.
– siloko
Dec 21 '16 at 11:53
add a comment |
I'm trying to create a sub directory under existing directory tree. I want to know if only the permissions of directory where I'll be creating my sub directory matter or the parent directories will also have some effect on the permission to create the directory?
I'll be doing this programmatically, so I need to be sure that I have covered a wide range of scenarios.
files permissions filesystems
I'm trying to create a sub directory under existing directory tree. I want to know if only the permissions of directory where I'll be creating my sub directory matter or the parent directories will also have some effect on the permission to create the directory?
I'll be doing this programmatically, so I need to be sure that I have covered a wide range of scenarios.
files permissions filesystems
files permissions filesystems
edited Dec 21 '16 at 14:28
terdon♦
132k32261441
132k32261441
asked Dec 21 '16 at 11:22
sadiq.alisadiq.ali
12413
12413
1
Why don't you try it? Create different directories with different permissions and see how they effect your ability to create a sub-directory. Should take you a few minutes.
– siloko
Dec 21 '16 at 11:53
add a comment |
1
Why don't you try it? Create different directories with different permissions and see how they effect your ability to create a sub-directory. Should take you a few minutes.
– siloko
Dec 21 '16 at 11:53
1
1
Why don't you try it? Create different directories with different permissions and see how they effect your ability to create a sub-directory. Should take you a few minutes.
– siloko
Dec 21 '16 at 11:53
Why don't you try it? Create different directories with different permissions and see how they effect your ability to create a sub-directory. Should take you a few minutes.
– siloko
Dec 21 '16 at 11:53
add a comment |
1 Answer
1
active
oldest
votes
Yes, they matter. To create a directory, you need to be able to write to its parent directory. Creating a directory is just like creating a file (after all, everything is a file) so you need write access to the parent. In addition, you need to be able to get to the parent directory which means you need execute access to all directories in the tree:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx------ bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
In the example above, dir2 is owned by bob. This means I cannot cd into it, and I can't cd into its subdirectory dir3 either:
$ cd dir1/dir2/
bash: cd: dir1/dir2/: Permission denied
$ cd dir1/dir2/dir3
bash: cd: dir1/dir2/dir3: Permission denied
If I give myself execute access to dir2, I will be able to move to both dir2 and dir2/dir3, but I still won't have the right to create files/directories in dir2:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx--x--x bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
$ cd dir1/dir2/
$ ls
ls: cannot open directory '.': Permission denied
$ touch file
touch: cannot touch 'file': Permission denied
As you can see above, while I can move into the directory, I can't list its contents because I don't have read access to it and I can't create anything there because I don't have write access.
So, to be able to create a new file or directory inside a directory you need:
Execute permissions on every parent directory of your target directory.
Execute and write permissions for the target directory.
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
add a comment |
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
);
);
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%2funix.stackexchange.com%2fquestions%2f331895%2frequired-permission-to-create-directory%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
Yes, they matter. To create a directory, you need to be able to write to its parent directory. Creating a directory is just like creating a file (after all, everything is a file) so you need write access to the parent. In addition, you need to be able to get to the parent directory which means you need execute access to all directories in the tree:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx------ bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
In the example above, dir2 is owned by bob. This means I cannot cd into it, and I can't cd into its subdirectory dir3 either:
$ cd dir1/dir2/
bash: cd: dir1/dir2/: Permission denied
$ cd dir1/dir2/dir3
bash: cd: dir1/dir2/dir3: Permission denied
If I give myself execute access to dir2, I will be able to move to both dir2 and dir2/dir3, but I still won't have the right to create files/directories in dir2:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx--x--x bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
$ cd dir1/dir2/
$ ls
ls: cannot open directory '.': Permission denied
$ touch file
touch: cannot touch 'file': Permission denied
As you can see above, while I can move into the directory, I can't list its contents because I don't have read access to it and I can't create anything there because I don't have write access.
So, to be able to create a new file or directory inside a directory you need:
Execute permissions on every parent directory of your target directory.
Execute and write permissions for the target directory.
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
add a comment |
Yes, they matter. To create a directory, you need to be able to write to its parent directory. Creating a directory is just like creating a file (after all, everything is a file) so you need write access to the parent. In addition, you need to be able to get to the parent directory which means you need execute access to all directories in the tree:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx------ bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
In the example above, dir2 is owned by bob. This means I cannot cd into it, and I can't cd into its subdirectory dir3 either:
$ cd dir1/dir2/
bash: cd: dir1/dir2/: Permission denied
$ cd dir1/dir2/dir3
bash: cd: dir1/dir2/dir3: Permission denied
If I give myself execute access to dir2, I will be able to move to both dir2 and dir2/dir3, but I still won't have the right to create files/directories in dir2:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx--x--x bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
$ cd dir1/dir2/
$ ls
ls: cannot open directory '.': Permission denied
$ touch file
touch: cannot touch 'file': Permission denied
As you can see above, while I can move into the directory, I can't list its contents because I don't have read access to it and I can't create anything there because I don't have write access.
So, to be able to create a new file or directory inside a directory you need:
Execute permissions on every parent directory of your target directory.
Execute and write permissions for the target directory.
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
add a comment |
Yes, they matter. To create a directory, you need to be able to write to its parent directory. Creating a directory is just like creating a file (after all, everything is a file) so you need write access to the parent. In addition, you need to be able to get to the parent directory which means you need execute access to all directories in the tree:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx------ bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
In the example above, dir2 is owned by bob. This means I cannot cd into it, and I can't cd into its subdirectory dir3 either:
$ cd dir1/dir2/
bash: cd: dir1/dir2/: Permission denied
$ cd dir1/dir2/dir3
bash: cd: dir1/dir2/dir3: Permission denied
If I give myself execute access to dir2, I will be able to move to both dir2 and dir2/dir3, but I still won't have the right to create files/directories in dir2:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx--x--x bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
$ cd dir1/dir2/
$ ls
ls: cannot open directory '.': Permission denied
$ touch file
touch: cannot touch 'file': Permission denied
As you can see above, while I can move into the directory, I can't list its contents because I don't have read access to it and I can't create anything there because I don't have write access.
So, to be able to create a new file or directory inside a directory you need:
Execute permissions on every parent directory of your target directory.
Execute and write permissions for the target directory.
Yes, they matter. To create a directory, you need to be able to write to its parent directory. Creating a directory is just like creating a file (after all, everything is a file) so you need write access to the parent. In addition, you need to be able to get to the parent directory which means you need execute access to all directories in the tree:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx------ bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
In the example above, dir2 is owned by bob. This means I cannot cd into it, and I can't cd into its subdirectory dir3 either:
$ cd dir1/dir2/
bash: cd: dir1/dir2/: Permission denied
$ cd dir1/dir2/dir3
bash: cd: dir1/dir2/dir3: Permission denied
If I give myself execute access to dir2, I will be able to move to both dir2 and dir2/dir3, but I still won't have the right to create files/directories in dir2:
$ sudo tree -pgu
.
└── [drwxr-xr-x terdon terdon] dir1
└── [drwx--x--x bob bob ] dir2
└── [drwxr-xr-x terdon terdon] dir3
$ cd dir1/dir2/
$ ls
ls: cannot open directory '.': Permission denied
$ touch file
touch: cannot touch 'file': Permission denied
As you can see above, while I can move into the directory, I can't list its contents because I don't have read access to it and I can't create anything there because I don't have write access.
So, to be able to create a new file or directory inside a directory you need:
Execute permissions on every parent directory of your target directory.
Execute and write permissions for the target directory.
edited Feb 19 at 10:41
answered Dec 21 '16 at 12:08
terdon♦terdon
132k32261441
132k32261441
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
add a comment |
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
Exactly what I wanted. I could not figure out that execute permission is required for navigation. Thanks.
– sadiq.ali
Dec 21 '16 at 14:23
add a comment |
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.
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%2funix.stackexchange.com%2fquestions%2f331895%2frequired-permission-to-create-directory%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
1
Why don't you try it? Create different directories with different permissions and see how they effect your ability to create a sub-directory. Should take you a few minutes.
– siloko
Dec 21 '16 at 11:53