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


Unix Power ToolsUnix Power ToolsSearch this book

50.6. 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. Section 50.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 (Section 9.9):

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

-- JP



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.