Translating Mnemonic Permissions to Numeric Permissions

The permissions of a file, as you’ve seen throughout this chapter, come in sets of three—rwx, for read, write, and execute permissions. And, as we showed you, you set these permissions by specifying that each one is either “on” or “off.” For example, ugo+rwx sets read, write, and execute permissions to “on” for user, group, and other, while a+rw sets read and write to “on” for everyone, and a-x sets execute to “off” (indicated in directory listings with the -).

Rather than set permissions with letters and hyphens, however, you can translate them into numeric values, using 1 for “on” and 0 for “off.” So, rw-, with read and write “on” and execute off, would translate into the numbers 110

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.