[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to inherent the permissions related with o from the p
From: |
Bernhard Voelker |
Subject: |
Re: Is there a way to inherent the permissions related with o from the parent directory? |
Date: |
Wed, 18 Mar 2015 08:19:01 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 03/17/2015 11:42 PM, Peng Yu wrote:
> Hi,
>
> Is there a way to inherent the permissions related with o from the parent?
>
> For example, if the parent has the permission --- for o, when I mkdir
> a subdirectory, I want to subdirectory also has the permission --- for
> o. Is possible to somehow chmod of parent to allow this to happen?
You can e.g. set the permissions - all, i.e. not only for 'other' - with:
$ chmod --reference='.' DIR
Or, if you know the mode beforehand, you could tell mkdir(1) to use that
rather than the default (a=rwx minus umask):
$ mkdir --mode="$MODE" DIR
Getting only the 'other' access rights from the parent - using something
like `stat -c '%a' '.'` or `stat -c '%A' '.'`, and then parsing the
output - is awkward and prone to errors, because neither the numerical
form from '%a' nor the readable form from '%A' seem to have a stable-
formatted output.
Have a nice day,
Berny