home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 22.7 Using chmod to Change File Permission Chapter 22
File Security, Ownership, and Sharing
Next: 22.9 Protect Important Files: Make Them Unwritable
 

22.8 The Handy chmod = Operator

Let's say you have a set of files. Some are writable by you, others are read-only. You want to give people in your group the same permissions you have - that is, they can write writable files but can only read the read-only files. It's easy with an underdocumented feature of chmod :

% chmod g=u *

That means "for all files (* ), set the group permissions (g ) to be the same as the owner permissions (u )." You can also use the letter o for others, which is everyone who's not the owner or in the owner's group. Article 22.2 explains these categories.

If your chmod has a -R (recursive) option, you can make the same change to all files and directories in your current directory and beneath. If you don't have chmod -R , use this find (17.10 ) :

% find . -exec chmod g=u {} \;

The cpmod (22.16 ) program on the CD-ROM can copy all file permissions.

- JP


Previous: 22.7 Using chmod to Change File Permission UNIX Power Tools Next: 22.9 Protect Important Files: Make Them Unwritable
22.7 Using chmod to Change File Permission Book Index 22.9 Protect Important Files: Make Them Unwritable

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System