TuskenTower on 19 Jan 2010 06:55:17 -0800


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

[PLUG] Using find to chmod permissions


A question came up at the PLUG West meeting on how to replicate the
owner permissions to Group and Other for files.

Look before you leap:
find . -type f -user $USER -perm -u=x -ls
find . -type f -user $USER -perm -u=w -ls
find . -type f -user $USER -perm -u=r -ls

Replicate the permissions:
find . -type f -user $USER -perm -u=x -exec chmod go+x {} \;
find . -type f -user $USER -perm -u=w -exec chmod go+w {} \;
find . -type f -user $USER -perm -u=r -exec chmod go+r {} \;

Keep in mind that you don't really want to do this all the time.  You
are better of setting your UMASK to 000 if you need to share files and
you can't control user and group permissions.  It's been a while but I
think setting the sticky bit on directories will help ensure that all
files belong to specific users and groups.

As was mentioned in the meeting, don't blast away the execute
permissions on directories.

Amul
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug