Let’s start with the basic concept.
These are the following three permission classes in Linux:
User: The owner or the user who created the file belongs to this class. The ownership of a file can also be granted to other users.
Group: Multiple users belong to a group. All members of a group have the same permission access to a file.
Other: Any user who has access to the file but he is neither the owner nor belongs to any group belongs to this class.
Each file in Linux has the following three permission types:
Read: It allows the user to open and read the contents of the file. However, the user is not permitted to alter the contents of the file.
Write: It allows the user to edit and change the content of the file.
Execute: It allows the user to run the file (if it is executable).
Lrwxrwxrwx Meaning in Linux
Let’s see what these letters mean:
l: refers to a symbolic link.
r: read
w: write
x: execute
So, the “l” in lrwxrwxrwx permission means this file is a symbolic link. A symbolic link similar to a Windows shortcut is a type of file that points to another file or directory in the system. A symbolic has no content of its own but it contains the content of the actual file to which it points. If you make any change in the symbolic, it will be reflected in the actual file.
The lrwxrwxrwx apparently means maximum allowable permission. However, this is not true in the case of a symbolic link. Every symbolic link is created with lrwxrwxrwx permission but it is a dummy permission. The valid permission of a symbolic link is the permission of the actual file it links to.
Let’s explain it by an example. Create a sample1 file using the command below:
Now, view the permissions of the sample1 file through the ls command:
You will see that the owner has read and write permissions to the file. Remove the write permission through the command below:
Now if you view the permissions of the sample1 file, you will see the owner has only the read permission.
Create a symbolic link file sample2 pointing to the sample1 file.
If you view the permission, you will see the symbolic link has the lrwxrwxrwx permission.
To verify it, try to write to the symbolic link file. You will not be able to do that as it points to the sample1 file which has no write permission.
Now, allow the write permission to the actual file sample1.
If you try to write to the symbolic link, you will be able to do that as it reflects the permissions of the actual file which has now the write access.
Conclusion
That’s all! The symbolic links are created with the lrwxrwxrwx permissions but these permissions are never used in any operation. The actual permission of the symbolic link is the permission of the real file it points to. Now, I hope you have understood what the lrwxrwxrwx permission means in Linux. Check Linux Hint for more helpful articles.