Re: chmod woes


Subject: Re: chmod woes
bryan@ak.net
Date: Thu Oct 03 2002 - 01:05:33 AKDT


On Thu, Oct 03, 2002 at 12:02:18AM -0800, Justin Dieters <enderak@gci.net> wrote:
>
> I am trying to do a two things here:
>
> 1. Change all the files in all subdirectories of a directory to 660
> (rw-rw----), but leave the all directories +x so I can still get into them

find /path/name -type f -exec chmod 660 \{\} \;

> 2. Then change all the *.sh files in all subdirectories so they are +x

find /path/name -name "*.sh" -exec chmod +x \{\} \;

> Also, if someone could explain to me why I can't get into directories if
> they aren't +x, and also what a 's' or 'S' in place of the 'x' means
> when doing a 'ls -l' I would be very interested to find out :)

A directory is actually a file, whose contents are names of files,
and some of their associated information. If you have +r on a
directory, you can see its contents -- the file list. Having +x
("execute") permissions on a directory means that you can access
what's inside it. That means that if a directory is +x but -r,
you can access files in that directory if and only if you know the
filename already.

An 's' in place of the first 'x' means the file is "set-uid" --
if it's executable, it will run as if it were run by the owner of
the file. If that's root, the executable will run with superuser
permissions. If the second 'x' is replaced by 's', the file runs
as if it were run by someone in the same group as the owner of the
file.

Of course, 's' means something a little different for directories.
I don't remember what 'S' is off the top of my head. 't' is the
sticky bit. See the man page for ls for a bit more on this.

--
Bryan Medsker
bryan@ak.net

--------- To unsubscribe, send email to <aklug-request@aklug.org> with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Thu Oct 03 2002 - 01:07:29 AKDT