How to manage ownership of files in linux
In Linux operating system, there are three types of owners; 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. Group: A group can contain multiple users. All the users belonging to a group have same access permission for a file. 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 chgrp You can change the group owner of a file using the chgrp command. #chgrp <group name> <filename> chown The user owner of a file can be changed with chown command. #chown <user> <filename> You can also use chown...
Read More