Coming Full Circle—Back to umask

As you recall, the default umask on many systems is 022. Now that you understand the numeric system, it is easy to explain what this number means. When a non-directory file is created, the umask value is subtracted from 666 (directories subtract from 777) to come up with the default permission value to be assigned to the newly created file. Therefore, a umask of 022 makes the permissions of the file 644. This gives the owner read and write access, and gives the group and the rest of the world read permission.

When a new directory is created, the umask is subtracted from 777 instead of 666 to set the default permissions. Therefore, a umask of 022 would give a newly created directory permissions of 755. This means ...

Get Korn Shell Programming by Example 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.