lrwxrwxrwx in Linux

In Linux, each directory and file has a set of permissions that refers to their accessibility among various users. The users can have the read (r), write(w), and execute(x) permissions. The directories are recognized by the letter d in the permissions, while a simple file by dash (-) and a symlink link by the letter l.

This post will demonstrate the specific permission, lrwxrwxrwx, in Linux.  

What is lrwxrwxrwx in Linux?

Before proceeding toward the Lrwxrwxrwx, let’s have a quick recap of the permissions and the users associated with those permissions. 

Permissions:

  • Read: This permission allows you to read the contents of the file.
  • Write: This permission allows you to edit the contents of the file.
  • Execute: This permission allows you to execute the file.

Users:

  • Owner: It is the user who created the file.
  • Group: Different groups can access the file.
  • Other: The other user consists of the guest users. 

Example: 

An example is considered to understand “lrwxrwxrwx” permission in Linux. For instance, list down the content of the “etc” directory using the “ls -l” command that extracts the symbolic links via the “grep” command:

$ ls -l /etc | grep "\->"

The output represents the “lrwxrwxrwx” permissions in the “etc” directory.  

The explanation of this permission is mentioned below:

  • l” shows the file as the symbolic link to another file. 
  • The “rwx” specifies that the user, group, and other users have permission to read (r), write(w), and execute(x) the symbolic link. 

How is lrwxrwxrwx Permission Granted in Linux?

This section will present an example of where a file will be created and its symbolic link. Further, we will show how “lrwxrwxrwx” works: 

Step 1: Create a File 

Create the file using the touch command, such as “file.txt”:

$ touch file.txt

The file “file.txt” is created.

Step 2: Create the Symbolic Link

Now, create the symbolic link of the file “file.txt” to another file named “file1.txt” using the command:

$ ln -s file.txt file1.txt

The symbolic link is created.

Note: Creating the symbolic link will automatically create the file if it does not exist in the directory.

Step 3: Verify the Permission (Symbolic Link File)

Verify the permission of the symbolic link file (file1.txt) using the below-mentioned command:

$ ls -l file1.txt

The output shows that the permissions are granted by default.

Conclusion

In Linux, the “lrwxrwxrwx” shows that the file is the symbolic link to another file, and it allows all the permissions, read, writes, and execution to all its users and groups. Although these permissions are dummies, and actually, the symlink’s permissions are dependent on the file to which it is pointing. This post has demonstrated the permissions “lrwxrwxrwx” in Linux.