Copying Permissions

As one other shortcut, it’s possible to tell chmod “give users of one class the same permissions that some other class has.”

Let’s say we have these files:

d------rwx  joe  acctg  sales 
-rw-r--r--  joe  acctg  info.dat

The other users have full permissions on the sales directory. We’d like to say “ the user and group should be assigned (=) the permissions belonging to others.” That translates to:

   chmod ug=o

Similarly, to make info.dat readable and writable to the group, we can say:

   chmod g=u info.dat

(you can read this as “the group is assigned (=) the permissions currently held by the user.”)

You may also use + and - to add and subtract the permissions that currently belong to a different class of user.

You can’t mix the standard permissions (r, w, and x) with the coyping shortcuts. chmod will protest if you give it something like this:

   chmod g=wu info.dat
<< Try chmod Index Try chmod again >>