Category Archives: File Permissions In Linux

File Permissions In Linux


In Linux(like ubuntu/cent/fedora/kali etc.) and Unix, everything is a file. Directories are files, files are files and devices are files. Devices are usually referred to as a node, however, they are still files. All of the files on a system have permissions that allow or prevent others from viewing, modifying or executing. If the file is of type Directory then it restricts different actions than files and device nodes. The super user “root” has the ability to access any file on the system. Each file has access restrictions with permissions, user restrictions with owner/group association. Permissions are referred to as bits.

There are three types of access restrictions:

Permission | Action  | chmod option
read       | (view)  | r or 4
write      | (edit)  | w or 2
execute    |(execute)|x or 1

There are also three types of user restrictions:

User  | ls command output
owner | -rwx------
group |----rwx---
other |-------rwx

Folder/Directory Permissions

Directories have directory permissions. The directory permissions restrict different actions than with files or device nodes.
Permission | Action                           | chmod option
read       | (view contents, i.e. ls command) | r or 4
write      | (create or remove files from dir)|w or 2
execute    | (cd into directory)              | x or 1

  • read allows viewing the directories contents, i.e. ls command
  • write allows creating new files or deleting files in the directory. (Note: write access for a directory allows deleting of files in the directory even if the user does not have write permissions for the file!)
  • execute restricts or allows changing into the directory, i.e. cd command