How to Change the File/Folder Permission using Terminal?

File/Folder Permission
File/Folder Permission Graphical Illustration


Linux is a Unix-like, open source and community-developed operating system for computers, servers, mainframes, mobile devices and embedded devices. Every file and directory in Unix/Linux system have three permissions. They are read, write and execute.

 READ File/Folder Permission:

 The Read permission gives the permission to users only to read the file.

WRITE File/Folder Permission:

 The Write permission gives the permission to users only to write the file.

EXECUTE File/Folder Permission:

 The execute permission gives the permission to the user only to execute the file.

The default permissions for files on Unix system are 600 or 644. The permission 600 means the owner has read and write access while no other user can access the file. The permission 644 means the owner has read and write access while the group members and other users on the system have only read access.

For executable files, the equivalent settings would be 700 and 755. It corresponds to 600 and 644 except with execution permission.

The command ‘chmod’ is used to change the file permissions using the terminal. The command ‘chmod’ provides file permission 777 to read, write, and execute for all privileged users and the file permission 774 is the default to read, write, and execute for all the users.

Syntax: chmod 644 filename

Example: chmod 644 newfile.txt

Folder/Directory Permissions:

Each and every directory has the directory permissions. The directory permissions restrict the different actions than with files or device nodes.

PermissionActionchmod option
read(views contents, i.e. ls command)r or 4
write(create or remove a file from a directory)w or 2
execute(cd into a directory)x or 1
  • Read which restricts or allows viewing the directories contents, i.e.example: ls command
  • Write which restricts or allows creating new files or deleting files in the directory. It can allow the user to delete files in the directory even if the user does not have write permission to the file. 
  • Execute which restricts or allows changing into the directory, i.e.example: cd command.

Changing Permissions:

The command  ‘chmod’ is used to modify the permissions. The permissions can be modified with numbers or with a letter. Using letters is easier to understand for most of the people. When modifying permissions be careful not to create security problems. Some files are configured to have the very restrictive permissions to prevent unauthorized access.

chmod with Letters:

chmod {options} filename

aall (same as ugo)
+add permission
remove permission
=set permission

chmod with Numbers:

chmod {options} filename


The owner, Group, and Others are represented by the three numbers. To get the value for the options that determine the type of access needed for the file then add.

For example, if you want a file that has -rwx-rwx-rwx permissions you will use the following:

read, write & executeread,  write & executeread, write & execute
$ chmod 777 filename



Please enter your comment!
Please enter your name here