Translate

Image of Android Wireless Application Development
Image of Operating System Concepts
Image of Beginning Google Maps API 3
Image of Modern Operating Systems (3rd Edition)

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.