On Wed, Aug 11, 2010 at 02:51:35PM -0700, travis+ml-rs...@subspacefield.org wrote: > On Wed, Aug 11, 2010 at 01:32:42PM -0400, Brian Cuttler wrote: > [Set u+s on directories, don't worry about owners] > > It seems to work relatively well. I get an error about not being > able to chgrp the files owned by other users, and, in my case, > the group ends up wrong because it's not supposed to be the same > on both ends (www-data on destination, something else on source). > > However, because of the former problem, at least the extant files > stay readable until I can fix-up the group problem caused by the > latter. If I further chown them to www-data, then they don't get > their gid hosed the second time around. > > Not an ideal solution, but seems workable for the time being. > > Aside: chown really needs a flag that says "set GID on directories but > nothing else". Right now I do this, which is the only right thing to > do when filenames might contain anything, including whitespace or > newlines:
We use a # find command to find directories and feed it to the chown action. I'd have to think about/look-up the exact syntax, but its a one line command and runs fairly quickly since you can get the find to do the file selection (find directories) rather than passing that work further down the pipe. > setperms () { > local perms="$1" > local fileperm="$2" > local dirperm="$3" > local own="$4" > > local dir > > shift 4 > > for dir in "$@" > do > if test -d "$dir" > then > find "$dir" -xdev -type d -print0 | xargs -0 --no-run-if-empty chmod > "$perms","$dirperm" -- > find "$dir" -xdev -type f -print0 | xargs -0 --no-run-if-empty chmod > "$perms","$fileperm" -- > chown -R "$own" "$dir" > fi > done > } > > setperms u=rwX,o=rX g=rwX g=rwxs owner:group /path/to/whatever > -- > A Weapon of Mass Construction > My emails do not have attachments; it's a digital signature that your mail > program doesn't understand. | http://www.subspacefield.org/~travis/ > If you are a spammer, please email j...@subspacefield.org to get blacklisted. --- Brian R Cuttler brian.cutt...@wadsworth.org Computer Systems Support (v) 518 486-1697 Wadsworth Center (f) 518 473-6384 NYS Department of Health Help Desk 518 473-0773 IMPORTANT NOTICE: This e-mail and any attachments may contain confidential or sensitive information which is, or may be, legally privileged or otherwise protected by law from further disclosure. It is intended only for the addressee. If you received this in error or from someone who was not authorized to send it to you, please do not distribute, copy or use it or any attachments. Please notify the sender immediately by reply e-mail and delete this from your system. Thank you for your cooperation. -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html