Re: chmod / files and directories

2007-09-12 Thread Erik Osterholm
On Wed, Sep 12, 2007 at 11:34:31PM +0200, Mel wrote:
> On Tuesday 11 September 2007 13:15:55 Zbigniew Komarnicki wrote:
> > On Monday 10 of September 2007 17:56:12 Zbigniew Szalbot wrote:
> > > Hello,
> > >
> > > I did read man chmod but I am not really wiser. Is there an option to
> > > recursively set 755 permissions for directories and 644 for files?
> > > When I just issue
> > > chmod -R 755 /usr/local/www/data/wp/
> > > then all files and directories under wp/ are given permissions 755
> > > which is not what I want.
> >
> > Maybe also in such way:
> > # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;
> > # chmod -R a+X /usr/local/www/data/wp
> 
> That's the equivalent of chmod -R 755, since it sets exec bit on everything.
> Assuming all directories are already executable and files are not, the 
> shortcut would be:
> chmod -R o+w,go-w,a+r /usr/local/www/data/wp
> 
> -- 
> Mel

Mel,

According to the man page, using a+X (note the capitalization) should
only set the executable bit on directories, or on files which have any
executable bit set.  A quick test confirms this behavior.  I think
that the combination of the two commands that Zbigniew Komarnicki
listed will result in the desired permissions for the subtree.

Erik
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-12 Thread Mel
On Wednesday 12 September 2007 23:34:31 Mel wrote:
> On Tuesday 11 September 2007 13:15:55 Zbigniew Komarnicki wrote:
> > On Monday 10 of September 2007 17:56:12 Zbigniew Szalbot wrote:
> > > Hello,
> > >
> > > I did read man chmod but I am not really wiser. Is there an option to
> > > recursively set 755 permissions for directories and 644 for files?
> > > When I just issue
> > > chmod -R 755 /usr/local/www/data/wp/
> > > then all files and directories under wp/ are given permissions 755
> > > which is not what I want.
> >
> > Maybe also in such way:
> > # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;
> > # chmod -R a+X /usr/local/www/data/wp
>
> That's the equivalent of chmod -R 755, since it sets exec bit on
> everything. Assuming all directories are already executable and files are
> not, the shortcut would be:
> chmod -R o+w,go-w,a+r /usr/local/www/data/wp

Naturally that's u+w.

I shall proofread before pressing send.

-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-12 Thread Mel
On Tuesday 11 September 2007 13:15:55 Zbigniew Komarnicki wrote:
> On Monday 10 of September 2007 17:56:12 Zbigniew Szalbot wrote:
> > Hello,
> >
> > I did read man chmod but I am not really wiser. Is there an option to
> > recursively set 755 permissions for directories and 644 for files?
> > When I just issue
> > chmod -R 755 /usr/local/www/data/wp/
> > then all files and directories under wp/ are given permissions 755
> > which is not what I want.
>
> Maybe also in such way:
> # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;
> # chmod -R a+X /usr/local/www/data/wp

That's the equivalent of chmod -R 755, since it sets exec bit on everything.
Assuming all directories are already executable and files are not, the 
shortcut would be:
chmod -R o+w,go-w,a+r /usr/local/www/data/wp

-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-11 Thread Zbigniew Komarnicki
On Monday 10 of September 2007 17:56:12 Zbigniew Szalbot wrote:
> Hello,
>
> I did read man chmod but I am not really wiser. Is there an option to
> recursively set 755 permissions for directories and 644 for files?
> When I just issue
> chmod -R 755 /usr/local/www/data/wp/
> then all files and directories under wp/ are given permissions 755
> which is not what I want.

Maybe also in such way:
# find /usr/local/www/data/wp -type f -exec chmod 644 {} \;
# chmod -R a+X /usr/local/www/data/wp 

of course if you have symbolic links there see for additional options in chmod 
command as for example -L, -P, H.



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread RW
On Mon, 10 Sep 2007 15:59:31 -0400
Garance A Drosihn <[EMAIL PROTECTED]> wrote:

> At 1:38 PM -0400 9/10/07, Philip M. Gollucci wrote:
> >Daniel Bye wrote:
> >>  On Mon, Sep 10, 2007 at 10:01:35PM +0530, Shantanoo Mahajan wrote:
> >  >> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
> >>>  # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;
> >>>
> >>>  To be on safer side. :)
> >>
> >>  Oh? Safer how? I've never come across that idiom before.
> >
> >If imange the file or directory name has spaces, (){}-, etc.. in
> >it or even \.
> 
> This is not necessary with -exec in the 'find' command, and the
> single-quotes wouldn't have any effect.  The {} is a parameter
> which is seen by the find command itself.  If you add single-quotes
> around the {}, those quotes are stripped off by the *shell* before
> handing the parameter off to the 'find' command.

And special characters in the filenames aren't a problem since "find"
passes the arguments directly to  chmod as an array of null-terminated
strings, so they don't get interpreted by the shell.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Garance A Drosihn

At 1:38 PM -0400 9/10/07, Philip M. Gollucci wrote:

Daniel Bye wrote:

 On Mon, Sep 10, 2007 at 10:01:35PM +0530, Shantanoo Mahajan wrote:

 >> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;

 # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;

 To be on safer side. :)


 Oh? Safer how? I've never come across that idiom before.


If imange the file or directory name has spaces, (){}-, etc.. in
it or even \.


This is not necessary with -exec in the 'find' command, and the
single-quotes wouldn't have any effect.  The {} is a parameter
which is seen by the find command itself.  If you add single-quotes
around the {}, those quotes are stripped off by the *shell* before
handing the parameter off to the 'find' command.

Dangerous characters are more of an issue if you do not use the
'-exec' option, and instead you have 'find' print out the filenames
and then use those filenames with some other command.

--
Garance Alistair Drosehn=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Pollywog
On Monday 10 September 2007 16:31:35 Shantanoo Mahajan wrote:
> On 10-Sep-07, at 9:40 PM, Daniel Bye wrote:
> > On Mon, Sep 10, 2007 at 05:06:07PM +0100, Daniel Bye wrote:
> >> On Mon, Sep 10, 2007 at 05:56:12PM +0200, Zbigniew Szalbot wrote:
> >>> Hello,
> >>>
> >>> I did read man chmod but I am not really wiser. Is there an
> >>> option to
> >>> recursively set 755 permissions for directories and 644 for files?
> >>> When I just issue
> >>> chmod -R 755 /usr/local/www/data/wp/
> >>> then all files and directories under wp/ are given permissions 755
> >>> which is not what I want.
> >>> I can do it manually but since there are manyt subdirectories I
> >>> thought I would make my life easier. Many thanks in advance!
> >
> > Sorry, that *should* have been:
> >
> >   # find /usr/local/www/data/wp -type d -exec chmod 755 {} \;
> >   # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;
>
> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
> # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;

Why the single quotes around the {}  ?  I don't think I have seen that before 
and I want to understand it before I save it in my notes.  I have often 
wanted to perform the same task but I did not know if there was a way.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Daniel Bye
On Mon, Sep 10, 2007 at 01:38:13PM -0400, Philip M. Gollucci wrote:
> Daniel Bye wrote:
> > On Mon, Sep 10, 2007 at 10:01:35PM +0530, Shantanoo Mahajan wrote:
> >> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
> >> # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;
> >>
> >> To be on safer side. :)
> > 
> > Oh? Safer how? I've never come across that idiom before.
> If imange the file or directory name has spaces, (){}-, etc.. in it or
> even \.

Ah, I see. Yes, makes sense.

Cheers.

Dan

-- 
Daniel Bye

PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A


pgpBJbsIHm3Il.pgp
Description: PGP signature


Re: chmod / files and directories

2007-09-10 Thread Philip M. Gollucci
Daniel Bye wrote:
> On Mon, Sep 10, 2007 at 10:01:35PM +0530, Shantanoo Mahajan wrote:
>> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
>> # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;
>>
>> To be on safer side. :)
> 
> Oh? Safer how? I've never come across that idiom before.
If imange the file or directory name has spaces, (){}-, etc.. in it or
even \.


> 
> Cheers,
> 
> Dan
> 


-- 

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Senior System Admin - Riderway, Inc. http://riderway.com
1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB  B89E 1324 9B4F EC88 A0BF

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Daniel Bye
On Mon, Sep 10, 2007 at 10:01:35PM +0530, Shantanoo Mahajan wrote:
> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
> # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;
> 
> To be on safer side. :)

Oh? Safer how? I've never come across that idiom before.

Cheers,

Dan

-- 
Daniel Bye

PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A


pgpa59vxwgxSU.pgp
Description: PGP signature


Re: chmod / files and directories

2007-09-10 Thread Shantanoo Mahajan


On 10-Sep-07, at 9:40 PM, Daniel Bye wrote:


On Mon, Sep 10, 2007 at 05:06:07PM +0100, Daniel Bye wrote:

On Mon, Sep 10, 2007 at 05:56:12PM +0200, Zbigniew Szalbot wrote:

Hello,

I did read man chmod but I am not really wiser. Is there an  
option to

recursively set 755 permissions for directories and 644 for files?
When I just issue
chmod -R 755 /usr/local/www/data/wp/
then all files and directories under wp/ are given permissions 755
which is not what I want.
I can do it manually but since there are manyt subdirectories I
thought I would make my life easier. Many thanks in advance!


Sorry, that *should* have been:

  # find /usr/local/www/data/wp -type d -exec chmod 755 {} \;
  # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;


# find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
# find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;

To be on safer side. :)

regards,
shantanoo
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Zbigniew Szalbot
Hello,

2007/9/10, Shantanoo Mahajan <[EMAIL PROTECTED]>:
>
> On 10-Sep-07, at 9:40 PM, Daniel Bye wrote:
>
> > On Mon, Sep 10, 2007 at 05:06:07PM +0100, Daniel Bye wrote:
> >> On Mon, Sep 10, 2007 at 05:56:12PM +0200, Zbigniew Szalbot wrote:
> >>> Hello,
> >>>
> >>> I did read man chmod but I am not really wiser. Is there an
> >>> option to
> >>> recursively set 755 permissions for directories and 644 for files?
> >>> When I just issue
> >>> chmod -R 755 /usr/local/www/data/wp/
> >>> then all files and directories under wp/ are given permissions 755
> >>> which is not what I want.
> >>> I can do it manually but since there are manyt subdirectories I
> >>> thought I would make my life easier. Many thanks in advance!
> >
> > Sorry, that *should* have been:
> >
> >   # find /usr/local/www/data/wp -type d -exec chmod 755 {} \;
> >   # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;
>
> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
> # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;

Thank you all who have responded - until I memorise it :), I saved it
in my favorite commands list.

Thanks again!

Zbigniew Szalbot
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Philip M. Gollucci
Zbigniew Szalbot wrote:
> Hello,
> 
> I did read man chmod but I am not really wiser. Is there an option to
> recursively set 755 permissions for directories and 644 for files?
> When I just issue
> chmod -R 755 /usr/local/www/data/wp/
> then all files and directories under wp/ are given permissions 755
> which is not what I want.
> I can do it manually but since there are manyt subdirectories I
> thought I would make my life easier. Many thanks in advance!
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

You could also probably use mtree but you'd need to make the config file
first.

-- 

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Senior System Admin - Riderway, Inc. http://riderway.com
1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB  B89E 1324 9B4F EC88 A0BF

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: chmod / files and directories

2007-09-10 Thread Daniel Bye
On Mon, Sep 10, 2007 at 05:06:07PM +0100, Daniel Bye wrote:
> On Mon, Sep 10, 2007 at 05:56:12PM +0200, Zbigniew Szalbot wrote:
> > Hello,
> > 
> > I did read man chmod but I am not really wiser. Is there an option to
> > recursively set 755 permissions for directories and 644 for files?
> > When I just issue
> > chmod -R 755 /usr/local/www/data/wp/
> > then all files and directories under wp/ are given permissions 755
> > which is not what I want.
> > I can do it manually but since there are manyt subdirectories I
> > thought I would make my life easier. Many thanks in advance!
 
Sorry, that *should* have been:

  # find /usr/local/www/data/wp -type d -exec chmod 755 {} \;
  # find /usr/local/www/data/wp -type f -exec chmod 644 {} \;

But I guess you would have realised that!

Dan

-- 
Daniel Bye

PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A


pgpKwZhPhWjd8.pgp
Description: PGP signature


Re: chmod / files and directories

2007-09-10 Thread Daniel Bye
On Mon, Sep 10, 2007 at 05:56:12PM +0200, Zbigniew Szalbot wrote:
> Hello,
> 
> I did read man chmod but I am not really wiser. Is there an option to
> recursively set 755 permissions for directories and 644 for files?
> When I just issue
> chmod -R 755 /usr/local/www/data/wp/
> then all files and directories under wp/ are given permissions 755
> which is not what I want.
> I can do it manually but since there are manyt subdirectories I
> thought I would make my life easier. Many thanks in advance!

find(1) is your friend here:

 # find . -type d -exec chmod 755 {} \;
 # find . -type f -exec chmod 644 {} \;

Dan

-- 
Daniel Bye

PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A


pgp2idPOYHiUP.pgp
Description: PGP signature