permissions

Contents

Roadmap info from roadmap website

Linux File Permissions

In Linux systems, rights and privileges are assigned to files and directories in the form of permissions. These permissions indicate who can read, write, or execute (run) them. In Linux, there are three types of users: owners, groups, and others who can have a different set of permissions.

In fact, permissions on the system are there for a reason: to prevent unprivileged users from making changes on the system that would ultimately affect other users. With inadequate permissions, unprivileged users are able to make changes that would be beneficial or harmless to the Linux system.

Let’s have a look at an example:

-rwxr--r-- 1 root root 4096 Jan 1 12:00 filename

From the above example, the first character - indicates if it is a regular file(-) or directory(d). The following group of three characters(rwx) represents the permissions for the file owner. The next three characters(r--) represent permissions for the group and the last set of three characters(r--) represents permissions for others.

The r indicates that the file can be read, w indicates that the file can be written to, and x indicates that the file can be executed.

The permissions can be changed using the chmod, chown, and chgrp commands.

Learn more from the following resources:

$ ls -l
drwxr-xr-x. 2 myuser myuser 40 May 19 10:52 existing-dir
What isExplanation
Permissionsdrwxr-xr-x
d: Directory indicator
rwx: Owner permissions (read, write, execute)
r-x: Group permissions (read, execute)
r-x: Others’ permissions (read, execute)
Links2
Number of links to this directory, including . and entries for subdirectories.
Ownermyuser
User who owns this directory.
Groupmyuser
Group associated with this directory.
Size40
Directory size in bytes (40 bytes for small directories due to metadata).
Date ModifiedMay 19 10:52
Date and time when the directory was last modified.
Nameexisting-dir
Name of the directory.
#ready #online #reviewed #linux #operative-system