CHANGE FILE PERMISSIONS
مقاله آموزشی لینوکس
Maybe, you find a file that's can't be deleted in Linux Operating system. In Linux, each of file has permissions/previleges for the owner, the group and the other.So no each one can open, modify or delete the file. Each file in linux has atribut, it will appears if you try to execute command that display a list of file in directory :
at the first column there are 10 character that's consist of :
1. first character is indicates type of file
- indicates that the type of the file is a regular file
d indicates that the type of the file is a directory
l indicates that the type of the file is a symbolic link
b indicates that the type of the file is a block special file
c indicates that the type of the file is a character special file
s indicates that the type of the file is a socket link
2. Three character after the first character is indicates the permission for user that owned the file (so based on the example above, the permission for user is read(r),write(w) and execute(x).
3. Three character after that is indicates the permission for group (so based on the example above, group don't have a permission for this file)
4. The last three character is indicates the permission for other(except user that owned the file and their group), so based on the example there is no permissions for other.
- How to change the permissions ?
NOTE : WE CAN ADD OR REMOVE THE PERMISSION FOR A FILE FOR SPECIFIC USER OR GROUP OR OTHER IF WE JUST LOG IN AS SUPER USER (ROOT)
1. Based on the example above, we would like to change the permissions for the group for read(r), and execute(x) the file. To change the permission we use 'chmod' command (change modifications). For example :
fresh-IDEA Downloads# chmod g+rx 93197-gotchione.tar.gz
So the result will be like that :
2. The '+' character is used for add a permission for the file, but the '-' character is used for remove a permissions for the file. Form example we would like to remove the read(r) permission for the user that owned the file :
fresh-IDEA Downloads# chmod u-r 93197-gotchione.tar.gz
So the result will be like that :
Maybe, you find a file that's can't be deleted in Linux Operating system. In Linux, each of file has permissions/previleges for the owner, the group and the other.So no each one can open, modify or delete the file. Each file in linux has atribut, it will appears if you try to execute command that display a list of file in directory :
at the first column there are 10 character that's consist of :
1. first character is indicates type of file
- indicates that the type of the file is a regular file
d indicates that the type of the file is a directory
l indicates that the type of the file is a symbolic link
b indicates that the type of the file is a block special file
c indicates that the type of the file is a character special file
s indicates that the type of the file is a socket link
2. Three character after the first character is indicates the permission for user that owned the file (so based on the example above, the permission for user is read(r),write(w) and execute(x).
3. Three character after that is indicates the permission for group (so based on the example above, group don't have a permission for this file)
4. The last three character is indicates the permission for other(except user that owned the file and their group), so based on the example there is no permissions for other.
- How to change the permissions ?
NOTE : WE CAN ADD OR REMOVE THE PERMISSION FOR A FILE FOR SPECIFIC USER OR GROUP OR OTHER IF WE JUST LOG IN AS SUPER USER (ROOT)
1. Based on the example above, we would like to change the permissions for the group for read(r), and execute(x) the file. To change the permission we use 'chmod' command (change modifications). For example :
fresh-IDEA Downloads# chmod g+rx 93197-gotchione.tar.gz
So the result will be like that :
2. The '+' character is used for add a permission for the file, but the '-' character is used for remove a permissions for the file. Form example we would like to remove the read(r) permission for the user that owned the file :
fresh-IDEA Downloads# chmod u-r 93197-gotchione.tar.gz
So the result will be like that :