If you come across a rather cryptic word “lrwxrwxrwx” when listing files and directories, here’s how you can interpret it.

As you know, file permissions in Unix are traditionally provided using 3 levels:

  • user (file owner) permissions – specifically, permissions for the user currently setup as the file owner
  • group permissions – since each file belongs to a particular group, this permission level confirms the access other group members will enjoy
  • other (everyone else on the system) permissions

lrwxrwxrwx permissions

lrwxrwxrwx follows a permissions structure:

tUUUGGGOOO, where t is the file type indicator, UUU are the three characters specifying user (file owner) permissions, GGG are the group permissions and OOO are the others permissions.

So in the lrwxrwxrwx case, l stands for symbolic link – a special kind of pointer allowing you to have multiple filenames pointing to the same Unix file.

rwxrwxrwx is a repeated set of permissions, rwx meaning the maximum permissions allowable within basic settings.

Meaning of rwx

rwx permissions mean the following access is permitted:

  • r – read
  • w – write
  • x – execute (or change directory)

Interestingly, lrwxrwxrwx is a permission that’s rather uncommon: usually symlinks get a different (less forgiving) file permissions. Since symlinks are just pointers to other files, it doesn’t matter much if you provide w (write) permissions or not – they would not allow you to control write access to the destination file.

Example: we use the touch command to create a simple file called “file”. We specifically remove write permissions and this means we can’t write anything into the file as you can see:

[email protected]:~ $ touch file
[email protected]:~ $ ls -al file
-rw-r--r-- 1 greys staff 0 3 Oct 23:36 file
[email protected]:~ $ chmod u-w file
[email protected]:~ $ ls -al file
-r--r--r-- 1 greys staff 0 3 Oct 23:36 file
[email protected]:~ $ echo test > file
-bash: file: Permission denied

If we create a symlink file2 pointing to file, it will actually show first group of permission block (user permissions) to be rwx, so it may see you have write access to the file it’s pointing to:

[email protected]:~ $ ln -s file file2
[email protected]:~ $ ls -al file\*
-r--r--r-- 1 greys staff 0 3 Oct 23:36 file
lrwxr-xr-x 1 greys staff 4 3 Oct 23:37 file2 -> file

But if we try to write the same word “test” into file2 symlink, we’ll still get an error cause it’s pointing to the file which only has read permissions.

Finally, if we allow write permissions on the file again, we can write into file2 symlink and it will work just fine this time:

[email protected]:~ $ chmod u+w file
[email protected]:~ $ ls -al file\*
-rw-r--r-- 1 greys staff 0 3 Oct 23:36 file
lrwxr-xr-x 1 greys staff 4 3 Oct 23:37 file2 -> file
[email protected]:~ $ echo test > file2
[email protected]:~ $ cat file
[email protected]:~ $ cat file2

See also

Keep Learning

Follow me on Facebook, Twitter or Telegram:
I learn with Educative: Educative I'm also a fan of SetApp for macOS: SetApp for macOS
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
31 Jan 2023

Homelab: MacBook Pro M2

17 Nov 2022

Video: awk delimiters

25 Oct 2022

macOS Ventura 13.0

Recent Tweets