If you can see this check that

next section prev section up prev page next page

How to change existing permission numerically

You can also specify permissions for chmod using a number, using the format:

chmod number filename
where number is a three-digit or four-digit number specifying what permissions you want to assign to a file. If you use a three digit number then the system considers this to be equal to a four digit number with a leading 0. Each of the digits sequentially sets permissions for each of the four classes of special, owner, group, and other. The filename is the name of the file you want to modify. The class of "special" is used very rarely, and for our purposes is always 0.

The values for any digit related to owner, group, or other are derived from adding the value of the permissions from the following list:

Notice that if you add all of the values from the values from the list, the result is 7. The number 7 represents read, write, and execute permission values. For read and write permissions only, the value would be (4+2 = 6). Read and execute permissions only would be (4+1 = 5).

For example, again assume 'myfile' has the following default permissions:

-rwxr-----.  1 john staff 500 Nov 18 12:25 myfile
If we wish to give the group 'staff' write access to 'myfile' we could use the following command:
% chmod 760 myfile
% ls -l myfile 
-rwxrw----.  1 john staff 500 Nov 18 12:25 myfile
So in this case "760" is exactly the same as using "0760". Four digit permissions are considered more correct but in reality will almost always perform exactly the same as the three digit versions.

The following table shows the equivalency between numberic and symbolic for the chmod command.

Example


Centos 7 intro: Paths | BasicShell | Search
Linux tutorials: intro1 intro2 wildcard permission pipe vi essential admin net SELinux1 SELinux2 fwall DNS diag Apache1 Apache2 log Mail
Caine 10.0: Essentials | Basic | Search | Acquisition | SysIntro | grep | MBR | GPT | FAT | NTFS | FRMeta | FRTools | Browser | Mock Exam |
CPD: Cygwin | Paths | Files and head/tail | Find and regex | Sort | Log Analysis
Kali: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7a | 8a | 8b | 9 | 10 |
Kali 2020-4: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7 | 8a | 8b | 9 | 10 |
Useful: Quiz | Forums | Privacy Policy | Terms and Conditions

Linuxzoo created by Gordon Russell.
@ Copyright 2004-2023 Edinburgh Napier University