In this quickie I will give you a quick glimpse of users and groups in linux. What are they here for and how can you use them?
Linux is a multiuser OS. This means multiple users can log on to the system with their very own files and groups. You propably knew that, since almost every OS nowaday supports multiuser (even android phones for that matter). And with multiple users and groups comes also the need of permissions. Or else having multiple users and groups would be kinda pointless.
To handle permissions linux offers two conecpts. You can give permissions on a user level or on a group level.
First lets start with users. Since in the “permission notation” (eg.
rwxr-xr--) the first three letters refer to the owning user.
The owner of the file is usually the creator of it by default in most linux distributions. An example of user level permission is the
Each user of the home directory has full control over the files and permissions given within that area. The user could set the permissions so that only the user of that home would be able to read, write and execute the files. But the user could also set a specific group to be able to have restricted access to files within his home. For example if he is running a web server the group
www probably should have access to his
Which brings us to the next topic:
A group is a collection of zero or more users and a user can belong to multiple groups. They’re mostly used to manage multiple users (omg such a surprise, many wow).
For example if you wanted only certain users to be able to connect via
shh you could create a dedicated group for that instead of cicling through 1000s of users (in an enterprise network) and set it individually. You can set all the rights for ssh connection to that group and add the users to it.
You can see to which groups a specific users belong with
$ groups username.