Is there a means of automatically setting directory permissions - Setup

This is a discussion on Is there a means of automatically setting directory permissions - Setup ; Whenever I create a Linux directory it automatically sets the permissions to 755, is there a means of setting the initial permissions to be more restrictive automatically, such as 600? /voifpfc...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Is there a means of automatically setting directory permissions

  1. Is there a means of automatically setting directory permissions


    Whenever I create a Linux directory it automatically sets the
    permissions to 755, is there a means of setting the initial
    permissions to be more restrictive automatically, such as 600?

    /voifpfc


  2. Re: Is there a means of automatically setting directory permissions

    voipfc a écrit :
    > Whenever I create a Linux directory it automatically sets the
    > permissions to 755, is there a means of setting the initial
    > permissions to be more restrictive automatically, such as 600?


    umask manage this

    You can find it in /etc/bashrc or you can do it for only a user account
    in $HOME/.bashrc

    --
    François Patte
    Université Paris 5 - Paris

  3. Re: Is there a means of automatically setting directory permissions

    voipfc wrote:
    > Whenever I create a Linux directory it automatically sets the
    > permissions to 755, is there a means of setting the initial
    > permissions to be more restrictive automatically, such as 600?
    >
    > /voifpfc
    >


    This is done via a umask.

    A umask of 022 masks out the write bit for group and other.

    000 010 010
    rwx rwx rwx
    ------------
    rwx r-x r-x

    With regards to files that same umask masks against a rw file
    (by default new files don't have the execute bit set)

    000 010 010
    rw- rw- rw-
    ------------
    rw- r-- r--

    So you end up with 644 by default.

    To make it a restrictive as you are wanting, set your
    umask to 077

    000 111 111
    rwx rwx rwx
    ------------
    rwx --- ---

  4. Re: Is there a means of automatically setting directory permissions

    On May 30, 11:23 am, Chris Cox wrote:
    > voipfc wrote:
    > > Whenever I create a Linux directory it automatically sets the
    > > permissions to 755, is there a means of setting the initial
    > > permissions to be more restrictive automatically, such as 600?

    [snip]
    > To make it a restrictive as you are wanting, set your
    > umask to 077


    To ensure the OP's 600 results, he should set his umask to 177

    > 000 111 111
    > rwx rwx rwx
    > ------------
    > rwx --- ---



    001 111 111
    rwx rwx rwx
    ------------
    rw- --- ---
    6 0 0


  5. Re: Is there a means of automatically setting directory permissions

    On 30 May, 16:43, Lew Pitcher wrote:
    > On May 30, 11:23 am, Chris Cox wrote:
    >
    > >voipfcwrote:
    > > > Whenever I create a Linux directory it automatically sets the
    > > > permissions to 755, is there a means of setting the initial
    > > > permissions to be more restrictive automatically, such as 600?

    > [snip]
    > > To make it a restrictive as you are wanting, set your
    > > umask to 077

    >
    > To ensure the OP's 600 results, he should set his umask to 177
    >
    > > 000 111 111
    > > rwx rwx rwx
    > > ------------
    > > rwx --- ---

    >
    > 001 111 111
    > rwx rwx rwx
    > ------------
    > rw- --- ---
    > 6 0 0


    Is the umask command global, does it affect file creation for the user
    or for all account holders on the system?


  6. Re: Is there a means of automatically setting directory permissions

    On May 30, 1:23 pm, voipfc wrote:
    > On 30 May, 16:43, Lew Pitcher wrote:
    >
    >
    >
    > > On May 30, 11:23 am, Chris Cox wrote:

    >
    > > >voipfcwrote:
    > > > > Whenever I create a Linux directory it automatically sets the
    > > > > permissions to 755, is there a means of setting the initial
    > > > > permissions to be more restrictive automatically, such as 600?

    > > [snip]
    > > > To make it a restrictive as you are wanting, set your
    > > > umask to 077

    >
    > > To ensure the OP's 600 results, he should set his umask to 177

    [snip]
    > Is the umask command global, does it affect file creation for the user
    > or for all account holders on the system?


    umask may be altered by any process, for itself and any children it
    subsequently spawns. That umask is inherited by the child process, but
    is not the same umask as the parent - that is to say, if the parent
    changes it's umask subsequent to the forking of the child process, the
    child process' umask does not change to the new parent value.

    Given the structure of the Unix process tree, there is one progenitor
    umask that gets propogated and altered by each generation of processes
    in the process tree.



  7. Re: Is there a means of automatically setting directory permissions

    voipfc a écrit :
    > On 30 May, 16:43, Lew Pitcher wrote:
    >> On May 30, 11:23 am, Chris Cox wrote:
    >>
    >>> voipfcwrote:
    >>>> Whenever I create a Linux directory it automatically sets the
    >>>> permissions to 755, is there a means of setting the initial
    >>>> permissions to be more restrictive automatically, such as 600?

    >> [snip]
    >>> To make it a restrictive as you are wanting, set your
    >>> umask to 077

    >> To ensure the OP's 600 results, he should set his umask to 177
    >>
    >>> 000 111 111
    >>> rwx rwx rwx
    >>> ------------
    >>> rwx --- ---

    >> 001 111 111
    >> rwx rwx rwx
    >> ------------
    >> rw- --- ---
    >> 6 0 0

    >
    > Is the umask command global, does it affect file creation for the user
    > or for all account holders on the system?
    >


    depends on where you put it: in /etc/bashrc it affects all acounts, in
    $HOME/.bashrc, it affects only the holder of $HOME

    --
    François Patte
    Université Paris 5 - Paris

  8. Re: Is there a means of automatically setting directory permissions

    On 2007-05-30, voipfc wrote:
    >
    > Is the umask command global, does it affect file creation for the user
    > or for all account holders on the system?


    Simply running umask in a shell affects only that shell and
    subprocesses. Modifying the umask globally requires modifications to
    /etc/profile or the equivalent (and restarting any open shells, or
    getting every logged-in user to source the modified file). Modifying it
    for one user permanently requires modifying ~/.bash_profile or
    equivalent.

    --keith

    --
    kkeller-usenet@wombat.san-francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information


+ Reply to Thread