|user / owner||group||other|
|can||* read* write* execute||* read* execute||* read* execute|
|symbolic||rwx||r- x||r- x|
With this chmod calculator, you will quickly find out how to set the permissions of your files. On top of the calculations, we'll briefly explain what chmod is, give you a quick chmod example, as well as a linux permission chart. Also, if you want to check what those mysterious numbers next to the chmod command mean, you can do it with this permissions calculator.
Are you ready?
What is chmod command?
The name chmod is an abbreviation of change mode. It's a command used in Unix and Unix-type operating systems to change the permissions of files or directories.
There are different permissions for three classes: the user, the group and the others. But who is who?
|User / owner||the user/owner of a file or directory|
|Group||users who are members of the file's group|
|Others||users who are not the owner of the file or members of the group|
Permissions must be set for each class, and can be expressed in a couple of ways - in a symbolic format (rwx), or in a numeral system (binary or octal format):
|read, write and execute||rwx||111||7|
|read and write||rw-||110||6|
|read and execute||r-x||101||5|
|write and execute||-wx||011||3|
All you need to do is to choose permissions for each of the three classes.
This table above may be also called the unix or linux permission chart. Also, an additional letter may be shown in the leftmost position, denoting the file type, e.g.
drwxrwxrwx for a directory,
**-**rwxrwxrwx for a regular file.
So, how to use the chmod command? Check the following example:
Let's assume that we want to change the permissions in such a way that the owner can do everything to the file (read, write, execute), but we want everybody else only to be able to read and execute that file.
- Start from the owner's access - we want them to be able to read, write, and execute, so we can write this symbolically as rwx. This is our first triad. As we let the owner do all three actions, its binary code is 111. In the octal numeral system, it is the same as 7 (1112 = 1 * 22 + 1 * 21 + 1* 20 = 78).
- Proceed to the second class - group permissions. For this set, we only want them to read and execute the file, but not to change it (write). It can be expressed as r-x, with dash in the place of the writing permission. In binary representation it's 101 - in octal - 5 (1012 = 1 * 22 + 0 * 21 + 1 * 20 = 58).
- Finally we come to the third class - the others. We'd like to give them the same permissions as for the group class, so just repeat the characters from the previous step.
Take the digit that represents your permissions for each class in the octal system and you've got your result - chmod 755.
To sum up all we've learned from this chmod example, look at this table:
|read, write and execute||read and execute||read and execute|
|7||5||5||= chmod 755|
To set the permissions required in the example, just use the command chmod 755 file_name. You can do it manually, but, of course, our permissions calculator is here to help you do rapid conversions.
Chmod permissions: special modes
It may happen that you get four digits instead of three. What does the extra digit mean? And which is the additional one?
The three rightmost octal digits are always the permissions for the classes we mentioned before - owner, group, and others, respectively. If four digits are entered, then the leading number - the leftmost digit - addresses the three special modes:
- the setuid bit - short for a set user ID (in symbolic notation, 'x' becomes 's' and the '-' becomes 'S' for the user triad)
- the setgid bit - short for set group ID (in symbolic notation, 'x' becomes 's' and the '-' becomes 'S' for the group triad)
- the sticky bit - restricted deletion bit (in symbolic notation, 'x' becomes 't' and the '-' becomes 'T' for the others triad)
The first two access flags are used when different privileges than usual are granted (e.g., in the situation of changing passwords). The sticky bit is more commonly used on directories - it prevents ordinary users from moving or deleting the other user's files (e.g., from /tmp directory).
(out of 4)
You can find these special options in the
Advanced mode of our permissions calculator.
How to use this chmod calculator?
This chmod calculator has two functionalities - you can use it to:
- find the command to set the permissions for your files and directories,
- understand what the octal modes mean - e.g., chmod 777, chmod 400, chmod 4664.
The first functionality was explained above (in the chmod example paragraph), so let's focus on the other mode.
Let's assume that you are wondering what chmod 777 means:
- Choose the appropriate calculator mode. We need to pick the option:
decode octal number next to chmod.
- Input the value. Enter 777 into the field.
- Thanks to this permissions calculator, you will find out many useful things, yay!
- each class (user/owner, group, other) can read, write and execute the file/directory
- chmod 777 can also be expressed in the binary format as 111111111
- chmod 777 can also be shown in the symbolic form as rwxrwxrwx
Keep in mind that setting the permissions to chmod 777 may not be the best idea - the files will be readable, writable, and executable by everybody. Are you sure this is what you want?