chmod calculator

A small Mac OS X tool to convert UNIX style permissions from one representation to another. Presented in association with the [Secret About Box][sab].

Since the SAB website has since Gone Away, here is the writeup salvaged from a backup of said site:

cmib.png Chmod Calculator is exactly what is says it is : A graphical application that displays the various UNIX permissions in a friendly, easy to use format. _Lasar let SAB post the app on the condition that solios made an icon for it, which he has. It is nifty. It is also very, very easy to use, as you can see here:

cmscreen.jpg

You can download the Chmod Calculator here. It's a 72k gzipped tarballed disk image (disk utility, by the way, won't let you make anything smaller than 550k...), so it shouldn't take very long. :-)

The Help (Apple-?) for the Chmod Calculator:
by _Lasar

How to use this application.

UNIX style permissions are usually displayed in one of three forms:
- A numerical representation, consisting of three numbers
- A textual representation
- A number of checkboxes.

This app is useful for calculating the numerical and textual representations from the set of checkboxes, which are easier to understand for people who do not choose to spend about 25 hours a day in front of the computer. (I do choose to spend 25 hours a day in front of a computer, by the way.)

The checkboxes should be quite self-explanatory. The UNIX permission system makes distinctions between the owner of a file (or folder), the group the item belongs to, and everybody else. Each of these has its own set of permissions . There are again three different permissions: Read, write and execute.
You will find a similar display of the permissions in FTP apps and elsewhere, where you can change file permissions.

Whenever you change something (either in the text fields or the checkboxes, all three representations will be automatically updated.

You can also paste permissions in numerical or textual form from any source into the text fields and look at the checkboxes to see what they mean. If you enter an invalid value into one of the text fields, it will turn red until it is fixed. This also happens when the text in the field is too short or long to fit that field.

The numerical representation of the UNIX permissions is calculated like this: The first digit represents the permissions for the owner of the file, the second shows the group's permissions, the third shows the permissions for the rest.
Now, the read permission is given the value 4, write is 2 and execute is 1. All permissios that the owner/group/everybody has are added up. So if the owner of a file can read and write, the group can read only and everybody can't access the file at all, you'd go like this: Read is 4, write is 2, that makes six. Read is 4 and the group can't do anything else, so it's four. And everybody does not have any permissions, which makes zero.
That way, the numerical representation is 640.

The textual representation looks the most complicated, but is actually quite simple. It consists of ten characters, where each character stands for one permission, except for the first character, which shows whether the item that we are currently examining is a file or a folder. If it is a folder, the first character is a "d", otherwise it is a "-". Now come the other nine characters, which represent the checkboxes directly. We start with the owner. The owner's permissions are set down in the second, third and fourth character. If the user can read, the second character is an "r", otherwise it's a "-". If the user can write, the third character is a "w", otherwise (you're beginning to see a pattern) it's a "-". Finally the fourth character is an "x" if the owner can execute the file/folder, otherwise it's a "-". The pattern repeats. The next three characters are set up the same, but they show the group's permissions. And the last three characters show the permissions of everybody else.

So far so good.

The rest of the interface should be clear. You can rotate the checkboxes with the appropriate button. The logic behind this is that some applications like to put the permissions on top, others put them on the side. This way you can set it up the way you need it.

The "Is Folder" checkbox is only used for the textual representation. If it is set, the first character becomes a "d". Likewise, if you edit the text field and make the first character a "d", the checkbox is activated.

Lastly a menu named "Usual Permissions" exists, which lists a few of the most common permission sets. Upon selecting one of them, this permission set is displayed in the chmod window.

Speaking of chmod, the name of this little application comes from the UNIX command line tool "chmod", which is used to change the permissions of a file or folder. It uses the numerical or textual representation of the permissions to know what to do with a file or folder.

And that's about it.