File PERMISSION in Linux | Symbolic and numerical method permission | how to give the permission to the file

Linux we can give the permission in file and directory into two ways
1. SYMBOLIC
2. NUMERIC
Permission
1. read->only read not edit(4)
2. write->read and write(2)
3. exe->they can execute the file(1)
To whom? we can give the permission to three person
1. user->specified user
2. group->specified group(no of user)
3. other->not group or user
It (shows figure) contain 10 character 1st indicate file/dir Then next 3 for user permission (2to4) next 3 for group permission(5to7)next 3 for other permission (8 to 10)

Symbolic mode permission
Operator
+ Represent give the permission
- Represent remove the permission
[studentwebsite@localhost ~]$ ls
kumar
[studentwebsite@localhost ~]$ ls -l
-rw-rw-r-- 1 studentwebsite studentwebsite 0 64 Apr 8 23:28 kumar

See that in the studentwebsite user it has the one file like kumar
it has the permission
user-> rw
group->rw
other->r
Now I will change kumar file permission user ->rwx and group->r other->rw
How to change it.
Perform the following command

SYNTAX
#chmod usermaybe operator permission file/dir
Why it start with #?
#->represent root
So root and owner of the user only have the change permission to three person(user,group,other)


File PERMISSION in Linux | Symbolic and numerical method permission | how to give the permission to the file



[studentwebsite@localhost ~]$chmod u+rwx kumar

[studentwebsite@localhost ~]$ chmod g-w kumar
[studentwebsite@localhost ~]$ chmod o+rw kumar
[studentwebsite@localhost ~]$ ls -l
-rwxr--rw- 1 studentwebsite studentwebsite 0 64 Apr 8 23:28 kumar
if you like to give the permssion within one line follow command
[studentwebsite@localhost ~]$ chmod u+rwx,g-w,o+rw kumar
Numeric mode permission
read 4
write 2
execute 1
Total 7
[studentwebsite@localhost ~]$ ls -l
-rw-rw-r-- 1 studentwebsite studentwebsite 64 Apr 8 23:28 file1
-rwxr--rw- 1 studentwebsite studentwebsite 0 Apr 7 18:58 kumar

IN this director it has 2 file
file1 has permission
user-rw
group-rw
execute-r
Now i like to chage user rw into r_x
then groupg rw into __x
final other r into _wx
how to give numerical method to that permission
user r_x
read-4
execute-1
total-5
group __x
1
other _wx
3
[studentwebsite@localhost ~]$ chmod 513 file1
After the Numerical method permission
[studentwebsite@localhost ~]$ ls -l
-r-x--x-wx 1 studentwebsite studentwebsite 64 Apr 8 23:28 file1

Related post