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

Re: Lesson learned / file permissions



Frank Gevaerts wrote:
> Try 
> find /home/username/ -xdev -exec chmod o-rwx {} \;
> or
> find /home/username/ -xdev|xargs chmod o-rwx
> Be careful with the last one if you have filenamess with spaces in them.
> Otherwise, it should be slightly faster than the first one

The safe version of the second command you have is:
  find /home/username/ -xdev -print0 | xargs -0 chmod o-rwx

"-print0" causes find to print the lines with a NUL character (ASCII 0)
as the file separator, instead of the usual newline.  NUL is one of the
small list of characters that cannot appear in a Unix filename.

"-0" causes xargs to split on NULs, instead of spaces.

Ed




Reply to: