There are some ways to change permissions of group or ownership the files or directories. Let’s see how you can do that but
if you want to know what means the permissions check this. To see files permissions use the command below:
Copied!
ls –l
you can change permissions in Linux by using command “chmod” like this.
Copied!
chmod “permissions needed” filename
you can give permissions via numbers like “764” or via characters “o+w”. And now let's give it a detailed explanation each of that ways.
Numeric mode of changing permissions:
Each permission type has numeric value:
Read is equal to 4
Write is equal to 2
Execute is equal to 1
If we want to give “read + execute” permission to some file we should write “5” because as we see below the value of «read» is “4” and for
«execute» is “1” we just need to add this numbers.
in this table you can find the numeric values of permission types:
number |
permission type |
symbol |
0 |
no permissions |
--- |
1 |
execute |
--x |
2 |
write |
-w- |
3 |
execute + write |
-wx |
4 |
read |
r-- |
5 |
read + execute |
r-x |
6 |
read + write |
rw- |
7 |
read + write + execute |
rwx |
i.e if I will write something like this:
Copied!
chmod 764 myExampleFile
it will give “read + write + execute” permission to “user” group, “read + write” permission to “group” group and
“read” permission to “other” group of “myExampleFile” file.
Symbolic mode of changing permissions:
In the numeric mod you change permissions of all groups but here you can change permissions separately. To change permissions in
with numbers is used some specific symbols let’s meet with them.
in this table you can find the numeric values of permission types:
operator |
description |
+ |
add permission to file or directory |
- |
removes the permissions |
= |
Sets the permission and overrides the permissions which were set earlier. |
here are user detonations:
u User or owner
g group
o other
a all
and permission detonations:
r read
w write
x execute
here is an example how you can change permissions via symbols:
Copied!
chmod u+rw myExampleFile
it means now user have read and write permissions and the rest groups permissions will remain the same.
And via this command:
Copied!
chmod o-x myExampleFile
we say that “other” group will not have “execute” permission. But if before remove execute permission “other” group had “read”
and “write” permissions they will remain unchanged.
There are some ways to change permissions of group or ownership the files or directories. Let’s see how you can do that but
if you want to know what means the permissions check this. To see files permissions use the command below:
Copied!
ls –l
you can change permissions in Linux by using command “chmod” like this.
Copied!
chmod “permissions needed” filename
you can give permissions via numbers like “764” or via characters “o+w”. And now let's give it a detailed explanation each of that ways.
Numeric mode of changing permissions:
Each permission type has numeric value:
Read is equal to 4
Write is equal to 2
Execute is equal to 1
If we want to give “read + execute” permission to some file we should write “5” because as we see below the value of «read» is “4” and for
«execute» is “1” we just need to add this numbers.
in this table you can find the numeric values of permission types:
number |
permission type |
symbol |
0 |
no permissions |
--- |
1 |
execute |
--x |
2 |
write |
-w- |
3 |
execute + write |
-wx |
4 |
read |
r-- |
5 |
read + execute |
r-x |
6 |
read + write |
rw- |
7 |
read + write + execute |
rwx |
i.e if I will write something like this:
Copied!
chmod 764 myExampleFile
it will give “read + write + execute” permission to “user” group, “read + write” permission to “group” group and
“read” permission to “other” group of “myExampleFile” file.
Symbolic mode of changing permissions:
In the numeric mod you change permissions of all groups but here you can change permissions separately. To change permissions in
with numbers is used some specific symbols let’s meet with them.
in this table you can find the numeric values of permission types:
operator |
description |
+ |
add permission to file or directory |
- |
removes the permissions |
= |
Sets the permission and overrides the permissions which were set earlier. |
here are user detonations:
u User or owner
g group
o other
a all
and permission detonations:
r read
w write
x execute
here is an example how you can change permissions via symbols:
Copied!
chmod u+rw myExampleFile
it means now user have read and write permissions and the rest groups permissions will remain the same.
And via this command:
Copied!
chmod o-x myExampleFile
we say that “other” group will not have “execute” permission. But if before remove execute permission “other” group had “read”
and “write” permissions they will remain unchanged.