xinetd and umask - Linux

This is a discussion on xinetd and umask - Linux ; The xinetd man pages is not very clear about the umask attribute in the xinetd config file. See : "umask Sets the inherited umask for the service. Expects an octal value. This option may be set in the "defaults" section ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: xinetd and umask

  1. xinetd and umask

    The xinetd man pages is not very clear about the umask attribute in the
    xinetd config file. See :
    "umask
    Sets the inherited umask for the service. Expects an octal value. This
    option may be set in the "defaults" section to set a umask for all
    services. xinetd sets its own umask to the previous umask OR'd with 022.
    This is the umask that will be inherited by all child processes if the
    umask option is not used."

    I've understood that this attribute defines the umask for the files created
    by the services lauched by xinetd. But what I've not understood is about the
    inheritance and 022 OR stuff.

    What will be inherited to the services if the attribute is not set ? 022 or
    022 OR'd with something ?

    I don't understand this sentence (maybe because i'm a french...) "xinetd
    sets its own umask to the previous umask OR'd with 022."

    What could be understand by the words "xinetd sets its own umask..." is that
    we are talking about the default umask when no attribute is set... ?

    Well, after, it says : "it sets its own umask to the previous umask OR'd
    with 022".
    So, by default, umask sets a value, by OR's 022 with a previous value ? But
    where does it take this previous value ? Is it the value defined by the
    attribute ? (what would be opposite to what I said 4 lines before)

    Finally, what does it give if i set :
    umask 123 for example in the xinetd.conf file ?

    Thanks a lot for your answers !



  2. Re: xinetd and umask

    tibo wrote:

    When a new process is created (with the fork(2) system call), it
    inherits it's initial umask from its parent. It can then freely change
    it if it so wishes.

    > What will be inherited to the services if the attribute is not set ? 022 or
    > 022 OR'd with something ?


    When a file is created, it is created with all permission bits (777)
    minus the umask. The umask's purpose is to create a safeish default
    permission (if not given explicitly when the file is created).

    The standard umask that is set at startup is 022, which makes files
    (directories always have all the executable bits set) have the following
    permission

    rw-r--r-- For a file
    rwxr-xr-x For a dir

    > I don't understand this sentence (maybe because i'm a french...) "xinetd
    > sets its own umask to the previous umask OR'd with 022."


    The OR is referring to a binary OR operation (1 and 0 is 1, 0 and 0 is
    0, 1 and 1 is 0)

    So what the statement is saying, is that it will take the umask xinetd
    inherited when it started up, and ensure that it has at least the bits
    of 022, so if xinetd recieved a umask of 002, it will be changed to 022.

    If xinetd started out with the umask of 033, it would stay 033, because
    033 has all the bits that 022 has.

    033 in binary: 00000000 00000011 00000011
    022 in binary: 00000000 00000010 00000010
    -------------- -------- -------- --------
    033 OR 022: 00000000 00000011 00000011

    > Finally, what does it give if i set :
    > umask 123 for example in the xinetd.conf file ?


    123, as all of the bits that are on in 022 are on it 123.

    --
    Cameron Kerr
    cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
    Empowered by Perl!

  3. Re: xinetd and umask


    "Cameron Kerr" a écrit dans le message de
    news:40062c37@news.orcon.net.nz...
    > tibo wrote:
    >
    > When a new process is created (with the fork(2) system call), it
    > inherits it's initial umask from its parent. It can then freely change
    > it if it so wishes.
    >
    > > What will be inherited to the services if the attribute is not set ? 022

    or
    > > 022 OR'd with something ?

    >
    > When a file is created, it is created with all permission bits (777)
    > minus the umask. The umask's purpose is to create a safeish default
    > permission (if not given explicitly when the file is created).
    >
    > The standard umask that is set at startup is 022, which makes files
    > (directories always have all the executable bits set) have the following
    > permission
    >
    > rw-r--r-- For a file
    > rwxr-xr-x For a dir
    >
    > > I don't understand this sentence (maybe because i'm a french...) "xinetd
    > > sets its own umask to the previous umask OR'd with 022."

    >
    > The OR is referring to a binary OR operation (1 and 0 is 1, 0 and 0 is
    > 0, 1 and 1 is 0)
    >
    > So what the statement is saying, is that it will take the umask xinetd
    > inherited when it started up, and ensure that it has at least the bits
    > of 022, so if xinetd recieved a umask of 002, it will be changed to 022.
    >
    > If xinetd started out with the umask of 033, it would stay 033, because
    > 033 has all the bits that 022 has.
    >
    > 033 in binary: 00000000 00000011 00000011
    > 022 in binary: 00000000 00000010 00000010
    > -------------- -------- -------- --------
    > 033 OR 022: 00000000 00000011 00000011
    >
    > > Finally, what does it give if i set :
    > > umask 123 for example in the xinetd.conf file ?

    >
    > 123, as all of the bits that are on in 022 are on it 123.
    >
    > --
    > Cameron Kerr
    > cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
    > Empowered by Perl!


    Thank you for your clear answer.



+ Reply to Thread