Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] mkdir


Hi.

On Fri, Feb 17, 2012 at 8:42 AM, Matthew Hannigan <mlh@xxxxxxxxxx> wrote:

>
> Grant Street <grants@xxxxxxxxx> gave the answer previously,
>        chmod 2755 topdir
>
> which sets the setgid (the 2) and relaxed perms (the 755)
> But this didnt fix the existing dirs group ownership.
> Also you might want 775 instead of 755.
>
> See below for my take.
>
> On Wed, Feb 15, 2012 at 08:44:41PM +1030, Glen Turner wrote:
> [ .. ]
> > directory -- search for "sticky bit on directory". Even that might not
>
> not sticky bit, setgid bit (common mistake)
>
> > give the group access, it depends on the user's umask.
>
> The better couple of  invocations are:
>
>        chmod g+s topdir # set topdir setgid bit so group ownership is
> preserved
>
>        chgrp -hR SOMEGRP topdir        # repair group of existing files
> and dirs
>        chmod -R g+rwX,o+rX topdir      # to repair permissions for
> existing files and dirs
>
> I tend to use symbolic rather than octal,
> tends to be easier to remember and more precise/accurate.
>
> PS. exercise for the reader , find out what the -h and the capital X do
> (they're important!)
>
>
Your points taken on the 775 and the -h and -X options
Thanks.
L.