[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: permissions another question

On Wed, Oct 11, 2006 at 01:49:40PM +0000, Andrew Critchlow wrote:
> > Date: Wed, 11 Oct 2006 14:30:34 +0100 > > From: brad@fineby.me.uk
> > On Wed, 11 Oct 2006 13:17:46 +0000 > > "Andrew Critchlow" <a_critchlow@hotmail.com> wrote:
> >
> > > then /test/file I then use the command "chmod g+s test", now when I
> > > look at file using "ls -l" the group permissions for the file are
> > > still the same as they were originally?Am I doing something wrong? 
> >
> > The message you responded to didn't make it clear that this would
> > only affect files created after the change to the directory.  To change
> > settings to all files and sub-directories within the base directory,
> > you need to use the -R (recursive) option. 
> Should the files that have picked up the permisions read exactly the same as the folder, I did what
> you suggested, chmod g+s -R test and now the other files have shown up as:
> /test = drwsr--r--

At this point the directory is set as readable by group and world;
however, directories must be marked "executable" to allow seeing 
the contents.

> then I issue chmod g+s -R test
> /test = drwsr-Sr--

The capital "S" shows that the sticky bit is set, vs a small "s"
which implies that "x" is also set.  I think you'll see the effect
you're looking for by doing chmod g+x for each directory.  I'd do
this using find, e.g., one of:

    find /test -type d -exec chmod g+x {} \;

    find /test -type d | xargs chmod g+x

A habit I find useful is to first run these commands with echo to
see what's going to happen, so,

    find /test -type d -exec echo chmod g+x {} \;

    find /test -type d | xargs echo chmod g+x

> then I create a file within test
> cd test
> touch file
> and file permission are:
> /test/file = -rw-r--r--
> this look correct?

You're not showing the owner and group identifiers, so it's hard to
say.  Also, a common "gotcha" is that you need to log out & in after
adding your user id to a group.

Ken Irving, fnkci@uaf.edu

Reply to: