Re: [SLUG] Re: chmod probs. - add. info
On Fri, Apr 10, 2009 at 2:43 PM, Daniel Pittman wrote: > Bernie Pannell writes: > >> try doing the 2 commands in the opposite order, setting everything to >> 664, & then set the directories to 775, ie: >> >> chmod -R 664* >> chmod -R 775 *. > > Epic FAIL! > > The first command will remove the execute bit from every directory, > causing you some incredible grief, and then the second command just > won't work because you no longer have permissions to get at the > contained files sensibly. Homework: mkdir A touch A/B touch A/C chmod u-x A ls -l A rm A/B marvel at the weird. Also, remember, because one day you'll see this behaviour again, and having seen it before will save you from a very baffling 30 minutes while you fight against the machine. > > It /could/ work if you did this: chmod -R ug=rwX,o=rX * > > That uses the GNU chmod specific "only set executable if this is a > directory" flag, Close. Quoting from the man page: execute/search only if the file is a directory or already has execute permission for some user Hrm. "Only if the file is a directory" could probably be worded better. > which works more nicely, but probably isn't exactly the > right answer in the long term. > > Regards, > Daniel > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Re: chmod probs. - add. info
Bernie Pannell writes: > try doing the 2 commands in the opposite order, setting everything to > 664, & then set the directories to 775, ie: > > chmod -R 664* > chmod -R 775 *. Epic FAIL! The first command will remove the execute bit from every directory, causing you some incredible grief, and then the second command just won't work because you no longer have permissions to get at the contained files sensibly. It /could/ work if you did this: chmod -R ug=rwX,o=rX * That uses the GNU chmod specific "only set executable if this is a directory" flag, which works more nicely, but probably isn't exactly the right answer in the long term. Regards, Daniel -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Re: chmod probs. - add. info
Kyle writes: > Have to admit, when I read Daniel's response telling me to use "find", > I cringed. All my experiences with "find" have been very > tortoise-like. But that command came back instantaneously and did the > trick. Heh. I can't blame you: find is probably the most awful of the standard Unix commands, not least because whoever wrote it carefully set out to design the most user-confusing interface ever. It *looks* like find takes a set of arguments, just like any other Unix command, given they all start with a '-', eh? Don't be fooled, though. find(1) actually takes a description, written in a mini-language, that details what to find and what to do when you get there. Ignore the dash and think about it being a language, just like shell, and things become clearer, because now it makes *sense* that the arguments have different meanings in different orders. Unix: proof that just being old, and standard, doesn't make it sane. Regards, Daniel -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Re: chmod probs. - add. info
Thanks all. Have to admit, when I read Daniel's response telling me to use "find", I cringed. All my experiences with "find" have been very tortoise-like. But that command came back instantaneously and did the trick. Thanks again. Kind Regards Kyle James Polley wrote: On Fri, Apr 10, 2009 at 12:32 PM, Kyle wrote: I should clarify; But then if I do a chmod -R 664 *.jpg (and repeat for all other extensions), for some reason the chmod doesn't work. it works in the directory I'm presently in, but doesn't recurse. Yes. Daniel explained why: *.jpg expands to a list of all files whose name ends with .jpg *in the current folder*. There are no directories in that list, so chmod has nothing to recurse into. Daniel provided some find fu which should do what you want (I haven't tried it, just glanced over it). Kind Regards Kyle Kyle wrote: Hi Sluggers, I'm having a bit of grief with chmod and am hoping one of you gurus will set me straight pls. I have a bunch of directories with a bunch of files (pictures) in each. I want to set directories to 775 and files to 664. I can do a chmod -R 775 *. But then if I do a chmod -R 664 *.jpg (and repeat for all other extensions), for some reason the chmod doesn't work. the man page says; 'chmod -R ug=rwxX *' (if I understand it correctly) should change just the directories permissions for owner and group. (and I could do an o=rxX after). But that just works on everything as well. What am I missing? -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Re: chmod probs. - add. info
On Fri, Apr 10, 2009 at 12:32 PM, Kyle wrote: > I should clarify; > > But then if I do a chmod -R 664 *.jpg (and >> repeat for all other extensions), for some reason the chmod doesn't work. > > it works in the directory I'm presently in, but doesn't recurse. Yes. Daniel explained why: *.jpg expands to a list of all files whose name ends with .jpg *in the current folder*. There are no directories in that list, so chmod has nothing to recurse into. Daniel provided some find fu which should do what you want (I haven't tried it, just glanced over it). > > > Kind Regards > > Kyle > > Kyle wrote: >> >> Hi Sluggers, >> >> I'm having a bit of grief with chmod and am hoping one of you gurus will >> set me straight pls. >> >> I have a bunch of directories with a bunch of files (pictures) in each. I >> want to set directories to 775 and files to 664. >> >> I can do a chmod -R 775 *. But then if I do a chmod -R 664 *.jpg (and >> repeat for all other extensions), for some reason the chmod doesn't work. >> >> the man page says; 'chmod -R ug=rwxX *' (if I understand it correctly) >> should change just the directories permissions for owner and group. (and I >> could do an o=rxX after). But that just works on everything as well. >> >> What am I missing? >> > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Re: chmod probs. - add. info
try doing the 2 commands in the opposite order, setting everything to 664, & then set the directories to 775, ie: chmod -R 664* chmod -R 775 *. Regards, Bernie. On Fri, Apr 10, 2009 at 12:32 PM, Kyle wrote: > I should clarify; > > But then if I do a chmod -R 664 *.jpg (and > > repeat for all other extensions), for some reason the chmod doesn't work. > > it works in the directory I'm presently in, but doesn't recurse. > > > Kind Regards > Kyle > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] Re: chmod probs. - add. info
I should clarify; But then if I do a chmod -R 664 *.jpg (and > repeat for all other extensions), for some reason the chmod doesn't work. it works in the directory I'm presently in, but doesn't recurse. Kind Regards Kyle Kyle wrote: Hi Sluggers, I'm having a bit of grief with chmod and am hoping one of you gurus will set me straight pls. I have a bunch of directories with a bunch of files (pictures) in each. I want to set directories to 775 and files to 664. I can do a chmod -R 775 *. But then if I do a chmod -R 664 *.jpg (and repeat for all other extensions), for some reason the chmod doesn't work. the man page says; 'chmod -R ug=rwxX *' (if I understand it correctly) should change just the directories permissions for owner and group. (and I could do an o=rxX after). But that just works on everything as well. What am I missing? -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html