I'm stubborn or stupid (and that's not xor) (Was: CVS Import Permissions)

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Jan 31 01:54:17 PST 2006


On 2006-01-31 00:44, Duane <duane at greenmeadow.ca> wrote:
> Hi everyone,
>
> On the CVS server machine should our CVS repository directory belong to
> the cvs group, i.e. user==root, group==cvs?

It's usually a good idea.

> And as for the umask, as it appears to be 027, if we give the
> cvs group write permission on /usr/local/cvsrep then when we
> import our projects they will be writeable by members of group
> cvs and the owner of the project, in this case jim.

No.  This is not how `umask' works.  Whatever value `umask'
currently has is logically-AND-ed with 0666.  This means that by
using 027, the result is:

    $ python
    >>> print "%04o" % (066 & 027)
    0026

These are the bits that will be turned *off* for new files (see
the umask(2) manpage for details), so to find out which
permission bits are allowed, you have to use the reverse mask:

    >>> print "%04o" % (0777 & ~(066 & 027))
    0751

The 0751 allowed-bits mask is equivalent to:

    rwxr-x--x

This means that with a umask of 027, you are effectivelly
allowing only the bits in ``rwxr-x--x'' to be turned on by
default for new files, and this doesn't include write permission
for the group.

I know that the whole `umask' concept is a bit tricky to grasp,
since it depends on knowledge of numbering with an octal-base
*AND* it works in the reverse order of that people usually think
it does, but hopefully, with the help of our excellent manpages
and a bit of experimentation, it will become more obvious :)

> I apologize if I am being all the things suggested in my
> subject heading.

Nah!  Never apologize for a question.  There is no such thing as
a stupid question for this list (well, unless the question refers
to Windows, of course :P).

- Giorgos



More information about the freebsd-questions mailing list