However, if the owner user is in this group, the “user” permissions apply, instead of the group permissions. Group: Permissions in this class affect the group which owns the file.User: Permissions in this class affect the owner of the file.You can assign different permissions to these classes, and thus control who can access and modify files. Whenever a user creates a file or a directory, the file is “owned” by the user and the user’s default group.įor any file or directory, there are three types of “permission classes”. If it is not set, the OS won’t know whether it actually has the write permission.įiles and directories can be owned only by a single user and a single group. You might wonder: why won’t the write permission work without an execute permission on the directory? This is because of the fact that you can only retrieve the permissions of a directory when its execute bit is set. On the other hand, for directories, the write permission allows the user to enter the directory (with cd) and view metadata (like file permissions) of the files and directories within it. However, the permission has no effect on a file unless the read permission is also enabled. Execute: When set on a file, the write permission allows it to be executed.However, this permission has no effect on directories unless the execute permission is also enabled. For directories, the write permission allows a user to modify its contents (create, delete and rename files in it). Write: For a file, the write permission allows a user to modify and delete a file.
For directories, the read permission allows the user to view the names of files and other directories stored in it. Read: For a file, the read permission allows a user to view the contents of a file.In Linux, we use permissions to control what a user can do with a file or directory. These are system users and groups, which are used to run background processes securely. When running these commands, you will notice that there are a number of other users and groups that you didn’t create. The first part of each line contains the group name. Similarly, you can view the groups on your system by viewing the /etc/group file, by running: cat /etc/groupĪgain, each line contains the details of a user. Specifically, you can see the username at the beginning of each line, before the first. Here, every line contains details of a user. If you want to view the users on your system, you can view the /etc/passwd file by running the following command: cat /etc/passwd A particular user is associated with a “default group”, and can also be a member of other groups on the system. In order to make managing users easier, you can add users into a “group”. Every user has some properties associated with them, such as a user ID and a home directory. Linux uses the concept of users to separate various people who use the computer. Users and groupsīefore we discuss the concept of “ownership”, let us first look at “users” and “groups”. In this article, we will learn these concepts, and how you can change them using various commands. You can use these concepts to control who can access and modify files. Linux is a multi-user operating system, and it ensures the security of files with the concepts of “ownership” and “permissions”.