Users and Groups

You’re using the computer, so you are a user. Computers understand numbers better than names, so you have a number associated to you called a user id.

If you want to see your user id, the command id with the flag -u will show you.

Alpha:~ computerlamp$ id -u

Let’s pretend that you have a friend named Nick who also uses your computer sometimes. The two of you are working on a project together on the computer so you want to share your files so that bot of you can read them or write to them. You and Nick want your project to be secret too, so that only the two of you can access the files. For fun, we’ll call this project insight. It’s a super secret project to design helicarriers to be used by S.H.I.E.L.D. and you don’t want Hydra to see them.

But I digress. Back to the original problem. How do you and Nick make it so only the two of you can access your project?

Linux® has groups to solve this problem. This means you create a group of you and Nick (let’s pretend his username is nickfury) and this will let you and Nick make it so only the two of you can access the project insight files.

You actually already belong to groups that are added by default when your account was added to the system. The command groups returns a list.

Alpha:~ computerlamp$ groups
computerlamp staff admin netusers

That’s just an example. It isn’t every group I’m a member of and your results are certainly different from mine.

To add the new group, let’s call it shield, you need to talk to the system administrator for the computer system you’re using. She’s the one that set the whole thing up to begin with and can add the group. Once you do that, if you run the groups command you get a new list.

Alpha:~ computerlamp$ groups
computerlamp staff admin netusers shield

Now that we have the new group, in the next post we’ll talk about how to share your files with Nick and only Nick.

One thought on “Users and Groups

  1. Pingback: SuperUser aka Root - ComputerLamp

Leave a Reply

Your email address will not be published. Required fields are marked *