Access to files by users are controlled by file permissions. The Linux file
permissions system is simple but flexible, which makes it easy to understand and apply, yet able to
handle most normal permission cases easily.
Files have just three categories of user to which permissions apply. The file is owned by a user, normally
the one who created the file. The file is also owned by a single group, usually
the primary group of the user who created the file, but this can be changed. Different permissions can
be set for the owning user, the owning group, and for all other users on the system
that are not the user or a member of the owning group.
The most specific permissions apply. So, user permissions override group permissions, which override other permissions.
In the graphic that follows, joshua is a member of the groups joshua and web, while allison is a member of allison, wheel, and web. When joshua and allison have the need to collaborate, the files should be associated with the group web and the group permissions should allow the desired access.
The most specific permissions apply. So, user permissions override group permissions, which override other permissions.
In the graphic that follows, joshua is a member of the groups joshua and web, while allison is a member of allison, wheel, and web. When joshua and allison have the need to collaborate, the files should be associated with the group web and the group permissions should allow the desired access.
Group membership illustration
There are also just three categories of permissions which apply: read, write,
and execute. These permissions affect access to files and directories as follows:
Effects of Permissions on Files and Directories
Permission | Effect on files | Effect on directories |
---|---|---|
r (read) |
Contents of the file can be read. | Contents of the directory (file names) can be listed. |
w (write) |
Contents of the file can be changed. | Any file in the directory may be created or deleted. |
x (exec) |
Files can be executed as commands. | Contents of the directory can be accessed (dependent on the permissions of the files in the directory). |
Note that users normally have both
read
and exec
on read-only directories, so that they
can list the directory and access its contents. If a user only has read
access on a directory, the names of the files in it
can be listed, but no other information, including permissions
or time stamps, are available, nor can they be accessed.
If a user only has exec
access on a directory, they cannot list the names of the files in the directory,
but if they already know the name of a file which they have permission to read, then they can access the contents of
that file by explicitly specifying the file name.A file may be removed by anyone who has write permission to the directory in which the file resides, regardless of the ownership or permissions on the file itself. (This can be overridden with a special permission, the sticky bit, which will be discussed at the end of the unit.)
Comments
Post a Comment
thank you for visiting :)