Understanding Linux permissions
Whoever heard of Linux has heard of its ironclad security, or that when you use Ubuntu you won’t get any viruses or the likes. File system permissions is a key part (but not the most important) of this magic.
Note: This post is written to make you understand basics Linux permissions, you will need near to zero Linux knowledge to understand these concepts.
Read, Write and Execute
Read, Write and Execute are the three basic permissions, you won’t need anything else to get started, but before we get ahead and understand how to use them, it’s important to understand what they do.
- Read: will enable you to read the file (or the folder’s table of contents), as the name suggest.
- Write: with this you can modify the file (or create a new file in the case of a folder).
- Execute: enables you to run the program; if it is set on a folder enables you to access that folder.
Note: You will probably find it difficult to understand how permissions are assigned to files, programs and folders. That’s normal. For now just remember what read/write/execute do.
In depth: In Linux EVERYTHING is a file: folders, files themselves, programs, even hard disks! Knowing that, every file has permissions.
Read, Write and Execute have different forms
We read them as words, but for computers it’s not that simple, to tell the truth… read, write and execute are actually… numbers! (bits to be more precise). Since the entire word “read” or “execute” is way too big to be listed and repeated many times, you won’t usually find permissions in the form of read/write/execute, instead you will find one of these two forms:
- Read: either r or 4
- Write: either w or 2
- Execute: either x or 1
User, Group and Others
Each file will have these three subjects. Each subject will have its own permissions. The user subject is the owner of the file, he usually has the highest level of permissions. The group subject is the group assigned to that file, meaning that if the group has writing permission (w) each user of that group will have writing permissions (so long they are still in that group). The other subject is simply ANYONE else. Be careful when assigning permissions to these three subjects, since they are the most basic and most permissive form of control.
Be sure to follow the next post of this series, in which I will explain how to manipulate permissions.