written 7.8 years ago by | • modified 7.8 years ago |
Mumbai University > Information Technology > Sem 5 > Open Source Technology
Marks: 5M
Year: Dec 2015
written 7.8 years ago by | • modified 7.8 years ago |
Mumbai University > Information Technology > Sem 5 > Open Source Technology
Marks: 5M
Year: Dec 2015
written 7.8 years ago by |
Linux file access permissions are used to control who is able to read, write and execute a certain file. This is an important consideration due to the multi-user nature of Linux systems and as a security mechanism to protect the critical system files both from the individual user and from any malicious software or viruses. Access permissions are implemented at a file level with the appropriate permission set based on the file owner, the group owner of the file and world wide access. In Linux, directories are also files and therefore the file permissions apply on a directory level as well, although some permission are applied differently depending upon whether the file is a regular file or directory. As devices are also represented as files then the same permissions commands can be applied to access to certain resources or external devices.
Basic File Permissions
Permission Groups
Each file and directory has three user based permission groups:
Permission Types
Each file or directory has three basic permission types:
read - The Read permission refers to a user's capability to read the contents of the file.
Viewing the Permissions
You can view the permissions by checking the file or directory permissions in your favorite GUI File Manager (which I will not cover here) or by reviewing the output of the \"ls -l\" command while in the terminal and while working in the directory which contains the file or folder.
The permission in the command line is displayed as: _rwxrwxrwx 1 owner:group
Modifying the Permissions
When in the command line, the permissions are edited by using the command chmod. You can assign the permissions explicitly or by using a binary reference as described below.
Explicitly Defining Permissions
To explicitly define permissions we need to reference the Permission Group and Permission Types.
The Permission Groups used are:
o or a - All Users
The potential Assignment Operators are + (plus) and - (minus); these are used to tell the system whether to add or remove the specific permissions. The Permission Types that are used are:
x - Execute
So for an example, let’s say we have a file named file1 that currently has the permissions set to_rw_rw_rw, which means that the owner, group and all users have read and write permission. Now we want to remove the read and write permissions from the all users group.
To make this modification we would invoke the command: chmod a-rw file1
to add the permissions, we would invoke the command: chmod a+rw file1