Translate

Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Beginning Google Maps API 3
Image of Linux Kernel Development (3rd Edition)
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

GNU chmod Oddities and Factoids

This blog post will be a living post detailing some of the more interesting oddities and factoids about the GNU Coreutils version of the chmod command which comes with all current Linux distributions. Expect this post to be updated from time to time.

Numeric Values and Special File Permission Removal
Special Unix file permissions are the setuid, setgid, and sticky bits. I assume you know what these bits do so I am not going to waste your time describing the bits here in this post. Suffice to point out the bits have different meanings depending on whether they apply to a file or a directory.

Consider the following use of the chmod command on a file that I created under my home directory using the touch command:

Note that chmod 7777 set all special file permissions on the file and chmod 710 removed ALL the special file permissions.

Compare and contrast that behavior on a file to what happens when applied to a directory as shown below.

Here neither chmod 710 nor chmod 0710 remove the special file permissions. Instead you must add another leading zero, i.e. 00710 for the special file permissions to be removed from the directory.

A disclaimer. Most of these oddities were not discovered by me.

Comments are closed.