-->

Decoding File Permissions Linux

Now that you know about users and groups, it’s time to decode the cryptic file permissions you’ve seen when using the ls command. This section describes how to decipher the permissions and where they come from.

Linux Decoding File Permissions
Linux Decoding File Permissions 


Using file permission symbols
the ls command allows you to see the file permissions for files, directories, and devices on the Linux system:

$ ls -l
total 68
-rw-rw-r— 1 rich rich 50 2010-09-13 07:49 file1.gz
-rw-rw-r— 1 rich rich 23 2010-09-13 07:50 file2
-rw-rw-r— 1 rich rich 48 2010-09-13 07:56 file3
-rw-rw-r— 1 rich rich 34 2010-09-13 08:59 file4
-rwxrwxr-x 1 rich rich 4882 2010-09-18 13:58 myprog
-rw-rw-r— 1 rich rich 237 2010-09-18 13:58 myprog.c
drwxrwxr-x 2 rich rich 4096 2010-09-03 15:12 test1
drwxrwxr-x 2 rich rich 4096 2010-09-03 15:12 test2
$

The first field in the output listing is a code that describes the permissions for the files and directories. The first character in the field defines the type of the object:


  • - for files
  • d for directories
  • l for links
  • c for character devices
  • b for block devices
  • n for network devices

After that, you see three sets of three characters. Each set of three characters defines an access permission triplet:

  • r for read permission for the object
  • w for write permission for the object
  • x for execute permission for the object

If a permission is denied, a dash appears in the location. The three sets relate the three levels of security for the object:

  • The owner of the object 
  • The group that owns the object
  • Everyone else on the system



This is broken down 
The Linux file permissions
The Linux file permissions



The easiest way to discuss this is to take an example and decode the file permissions one by one:

-rwxrwxr-x 1 rich rich 4882 2010-09-18 13:58 myprog

The file myprog has the following sets of permissions:

  • rwx for the file owner (set to the login name rich)
  • rwx for the file group owner (set to the group name rich)
  • r-x for everyone else on the system

These permissions indicate that the user login name rich can read, write, and execute the file (considered full permissions). Likewise, members in the group rich can also read, write, and execute the file. However, anyone else not in the rich group can only read and execute the file; the w is replaced with a dash, indicating that write permissions are not assigned to this security level.

0 Response to "Decoding File Permissions Linux"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel