What is CHOWN Linux and How to Use It

In this article, we will discuss the differences between CHMOD and CHOWN and how to use them. In addition, there are also some things you need to know why CHMOD and CHOWN are important. Before that, you can first read a brief explanation about Linux and the command text.

Linux is an operating system that is already familiar today. These operating systems mostly use text commands to install, move and copy files, or operate them. There are many basic linux commands, but there are two commands that are often used that are important to know, namely CHMOD and CHOWN.

CHMOD and CHOWN are widely used to set permissions and ownership of files and folders in Linux. At first glance, the two commands have the same function, but they don’t. In order to more clearly understand the difference between CHMOD and CHOWN, we will discuss it in this article in full.

Basic Access and Ownership Rights on Linux

Linux is an operating system similar to Unix in that every file and folder has an owner and group . While others is used for users who are not the owner and are not in the same group.

All files in Linux have three types of users (sometimes called classes) above. The three classes describe what commands can/can be applied to a file.

ownerAll users who create and own files/directories.
groupAll users are members of the same group.
othersAll other users in the system who are not owners or members of a group.

Commands that can be done in Linux are: read (the ability to open and view files), write (the ability to open and modify files), and execute (the ability to execute program files).

So in the management of permissions (access rights or ownership) in Linux. All owner , group , and others classes can read , write , or execute. It’s just a matter of how we manage it on a file or folder.

See also  11 Best Keyword Tools for SEO

Difference between CHMOD and CHOWN

In simple terms, there is the most basic difference between chmod and chown, which is based on their function.


Chown is a Linux command that comes from the abbreviation of the ch ange own er (change mode). This command is used to change the ownership of a file or folder to a specific user. The goal is that only the user who owns the file or folder can open it.

For example, there is a folder or file named A which was previously owned by the jaems user , then the chown command is executed and ownership is given to a new user named james. After being replaced, then folder A changed ownership to james.

Chmod a Linux command whose name is derived from the word ch ange mod e (change mode). This command is used to change the mode of a file or folder. There are three types of access rights that are usually used by chmod and their symbols, namely:

  • r for read
  • w for write
  • z to execute

Generally when using the chmod command use a number to declare the desired permission type.

No permission
3-wxWrite and Execute
5rxRead and Execute
6rw-Read and Write
7rwxRead, Write, and Execute

Or 7 comes from 1+2+4 which means 1 (execute), 2 (write), 4 (read) so 7 becomes (execute, write, and read).

To make it easier to understand the difference between chmod and chown, here are some examples of using chmod and chown in file management on Linux.

How to Use CHMOD and CHOWN

The chown and chmod commands can be run using the Linux Terminal. These two commands can only be executed by the root user or super user . You can view the ownership and user owners of a file using the ls -l or ll commands .

The results will be displayed in a format like this:

drwxrwxr-x 2 antvps antvps 4090 Dec 3 07:16 folderC

drwxrwxr-xThis section displays the permissions (permissions) of a file or folder. The letter d in front means that it is a directory. If the file has no leading letters, for example like this -rw-rwx-wxrwx is the type of permission that applies to the file or folder.

The initial “rwx” indicates the permissions for the user . “Rwx” both indicate the permissions for the group owner, and rx show user type permissions for others .

2Number of hard links. Usually a hard link is an additional name for a file.
antvpsIs the user name information owner of the file or folder.
antvpsIs the group name information of a file or folder.
4096Displays the file size in bytes. You can use the -h option to display sizes in other forms
Dec 3 07:16The last date the file was modified.
FolderCFile or folder name.

CHMOD to Change File and Folder Permissions

The command used to change permissions in Linux is very simple. Chmod has the following format:

$ chmod [permissions] [files]

“[permission]” can be numeric notation, which is the best format for changing permissions for all types of users.

For example, if you want to change the permissions of folderC to “drwx-r–rw-”, the command used is like this:

$ chmod 746 folderC

Or if changing the file to

$ chmod 746 fileC.txt

“[permission]” can also use symbol notation, which is easier to use to modify certain types of users.

For example, if you want to change the permissions of user (u) to “rwx”, group (g) to “rw”, and others (o) to “rw”, the command used is like this:

$ chmod u=rwx fileC.txt


$ chmod g=rw fileC.txt

$ chmod o=rw fileC.txt

Or can use a single command line:

$ chmod u=rwx,g=rw,o=rw fileC.txt

In certain cases, you want to add access rights for one of the users. Examples of commands that can be used like this:

$ chmod u+x fileC.txt

The above command reads ‘add execute (x) in the fileC.txt file for the user. Sedankan to eliminate can use a command like this:

$ chmod o-wx fileC.txt

Finally, if you want to change the permissions of the folder and all its contents, you can add a recursive option with the -R symbol in the command before executing it. An example of the command is like this:

$ chmod -R 755 folderC

You can view information related to the chmod user using the “ man chmod ” command .

There are several chmod modes that are often used, namely chmod 644, chmod 777, chmod 755, and chmod 555.

What Does CHMOD 644 Mean?

These permissions are ideal for publicly accessible files because they balance flexibility with security. Usually the chmod 644 setting is used for files on the website. Setting file permissions to chmod 644 means that only the owner can access and modify the desired file. While other users can only access it without being able to modify or even execute the file, including the owner of the file.

What Does CHMOD 777 Mean?

Setting permissions to chmod 77 means that all users can do whatever they want with the file. This is very risky at the level of security, especially for files that are shared publicly such as on hosting. In general, all users can access it, modify it, and even execute it on the system.

What Does CHMOD 755 Mean?

Setting permissions to chmod 755 is almost the same as chmod 644. The difference is that all users have access rights to execute files. This is usually used for public folders that require commands to move from one directory to another.

What Does CHMOD 555 Mean?

Setting permissions to chmod 555 makes the file unmodifiable by all users except superuser.

CHOWN to Change Ownership

Chown is used to change the owner and group of files and folders. In the example above, folderC is owned by the antvps user and the antvps group . If you want to change it there are several commands you can use.

Format of the “chown” command:

$ chown [owner/group owner] [filename]

Then we see an example of the file format that appears via the ls -l command above.

drwxrwxr-x 2 antvps antvps 4090 Dec 3 07:16 folderC

Changing Ownership

How to change ownership from antvps to root can be done using a command like this:

$ chown root folderC

The above command only changes the userowner, not the group owner.

Changing Group

If you want to change the group only, then the command used is like this:

$ chown :root folderC

The command above only changes the group owner, while the user owner remains.

Changing Ownership & Group

Another example is changing the user owner and group owner in one command.

$ chown root:root folderC

When “enter” then folder C will change user owner and user group to ” root “. Complete information on how to use “chown” you can see using the ” man chown ” command .

There are several chown options that are often used such as ” -c “, ” -R “, and ” -v “.

-c, –changesSimilar to verbose, but only when changes are made.
-R, –recursiveExecutes the command not only on the folder, but on all the files and folders in it.
-v, –verboseDisplays all operations performed, both failed and changes made.


The chown and chmod commands are very important to know, especially when it comes to files on websites. Files on the website should be accessible only to certain files, for example index.html.

If all files are open to public access rights, then all internet users can access those files online. Even though sometimes the files on the website are often important files and are quite dangerous if they are damaged or replaced by unknown users.

However, if all file access rights are made private, the website cannot be accessed.

Meanwhile, the difference between chown and chmod itself is in the function and how to use it. You can use it according to the needs you want to do.

Share This Article: