In Linux operating system, there are three types of owners;

  1. User: A user is the one who created the file. By default, whosoever, creates the file becomes the owner of the file. A user can create, delete, or modify the file.
  2. Group: A group can contain multiple users. All the users belonging to a group have same access permission for a file.
  3. Other: Any one who has access to the file other than user and group comes in the category of other. Other has neither created the file nor is a group member.

In this guide, we will see how to achieve basic file security through file ownership in our Linux system

user owner and group owner

The users and groups of a system can be locally managed in /etc/passwd and /etc/group, or they can be in a NIS, LDAP, or Samba domain. These users and groups can own files. Actually, every file has a user owner and a group owner, as can be seen in the following screenshot.

In here, the root user own 2 files.

listing user accounts

You can use the following command to list all local user accounts.

#cut -d: -f1 /etc/passwd | column


You can change the group owner of a file using the chgrp command.

#chgrp <group name> <filename>


The user owner of a file can be changed with chown command.

#chown <user> <filename>

You can also use chown to change both the user owner and the group owner.

#chown <user>:<group name> <filename>

list of special files

When you use ls -l, for each file you can see ten characters before the user and group owner. The first character tells us the type of file. Regular files get a , directories get a d, symbolic links are shown with an l, pipes get a p, character devices a c, block devices a b, and sockets an s.

Below a screenshot of a character device (the console) and a block device (the hard disk).

And here you can see a directory and a regular file.


The following two tabs change content below.
Ruwantha Nissanka is a Professional Cyber Security Engineer from Sri lanka with having a demonstrated history of providing cyber security services for multiple organizations in Sri Lanka. He is a positive person who wants to believe the best in others and he likes to help, encourage people and make them feel good.