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 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 ():
%find . -exec chmod g=u {} \;
The cpmod () program on the tutorial can copy all file permissions.
- JP