chmod: change the permissions mode of a file

Q: What is the "s" in drwxr-s-- when I enter ls -l?
A: Review Power Tools 1.23 and 22.05.

Q: What happens when you use the "=" operator for chmod?
A:  In symbolic mode using the equals sign, use this syntax:

chmod who1=perms,who2=perms,..... file

Each who means, u, g, o, or a combination.
Each  perms means r, w, x, or some of the other bits available. (See man chmod)
The man page refers to the equals as "setting absolutely". This term means that
the equals sign tells chmod to set only the perms entered for the who.

Example)
chmod g=r file
sets r-- on file for group. This command added r and removed x and w for group.

To remove permissions entirely, try
% chmod u=rwx,g=---,o=--- file
(no spaces between the commas!)
or

% chmod g=,o= file

See also 22.08 in the Power Tools book for an interesting -- and undocumented -- feature of chmod using "=".


Back to Top
Back to Information
Back to CS114 Home