Javatpoint Logo
Javatpoint Logo

What is chmod 755?

chmod is a command of Linux (Unix-like systems) that can be used to modify the file permissions. It changes group, user, and others to execute, write, and read permission. This chmod 755 Linux command is an essential use case to chmod. Generally, this command is applied to make various operations without any kind of difficulty because it facilitates ease for many system administrators during running applications.

Important: The Linux command "chmod" must be entered in lower-case letters.

If we implement the command, i.e., chmod 755 filename, we remit everyone to execute and read the file. In this case, the owner of the file is also permitted to write to this file. When we use 755 for any directory, it defines that anyone can access it.

Important: Usually, these permissions can be translated into rwxr - xr - x textual representation.

chmod command basics

We can apply chmod command for modifying any file's permission in Unix. We can also pass the permission of the file in a three-digit number form.

In 755 number, the first number 7 can be defined as permission provided to the owner, the second number 5 can be defined as the group permission, and the third number 5 can be defined as the permission of every other.

In other words, 755 can be represented as:

7 users execute, write, and read

5 groups execute and read

5 others execute and read

There are some essential permission types for groups and users:

  • Execute permission
  • Write permission
  • Read permission

Syntax

Command chmod has the syntax which can be defined as follows:

The command's permission part can have distinct types of formats. One format can be defined as a number's group same as the one we can see as follows:

Before we see the usage of chmod, we must know some of the options below:

-R: This option can change the permissions recursively.

-reference=FILE: It uses the mode of the FILE rather than the MODE values.

-c: It reports only if any modification is made.

-v: It can output the diagnostic for all the files processed.

The chmod command's octal representation

The permissions are also expressed in the form of octal representation (with 0-7 numbers).

And that's what 755 is exactly, a set of permission's octal representation for the group owner, user owner, and others.

The octal numbers initiate from the following number's sum:

1= execute permission

2= write permission

4= read permission

Hence, 7= 1 + 2 + 4= Execute + Write + Read permission

5= 1 + 4= Execute + Read permission

Where group owner, user owner, and other permissions can be considered separately.

Besides, the permission's sum for various user owners can generate one octal number (through 0-7) and it also uses for the group owner and other permissions.

Note: Remember to bypass from permission, i.e., 777 that provides full access for everyone. On directories or files, command 777 is not suggested for evident security reasons.

Command chmod 755 on directories and files usage

Let's understand the consequences of permissions on directories and files.

We wish to learn what execute, write, and read permission do through a user point of view if applied to directories or files.

Read permission:

  • directory: It can list the directory's content.
  • file: It can read the file's content.

Write permission:

  • directory: It can delete, rename, and add files into the directory.
  • file: It can change the file's content.

Execute permission:

  • directory: It can access any directory.
  • file: It can define any executable file (such as Bach script).





Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA