Transcript
  • Servers and Tools

Introduction to Users and Groups

From the class:  Users, Groups and Permissions

All right. Here we are logged into our Vagrant machine. And let's start this video off with an existentialism question. Who am I? This command will tell us who we're currently logged in as. And you can see that we're logged in as the user vagrant.

The reason that that's the case is because we're using the Vagrant tool, which automatically creates this user called vagrant. And when we login, it logs in as that user. You'll see a little bit later how we can create our own users on the system.

Now, to find out more about this user, we can use a special command called id. And if you want to learn about all the different options of ID, you can use the man pages and take a look at the options here. But what it does is it effectively lets us look at the user ID and the groups for this particular user. So let's see what this is telling us.

First, notice that every user gets this integer ID, abbreviated UID for User ID. And this user's ID is 1,000. And the name of the user is vagrant. And we can also see that the user belongs to a default group, which also gets it an integer ID of 1,000. And then, over on the far right we can see all the other groups that this user vagrant is a part of.

So we have a user called vagrant. And it's part of a group, which is also called vagrant. And that's something you're going to see often in Unix, where the user is also going to get a group that has the same name. And by default, the user will just be put into that group.

All of the users in the system are stored in a special file, which is in the etc or et cetera directory under a file called passwd. It's the password file for the system. We can use less to take a look at that file.

And if you scroll down, you can see the vagrant user that we're logged in as is in the list here, along with some information about the user like which shell it should use when we log in. And you can see there's a whole bunch of different users here. Some of them are just system users. Those are users that are used to control a particular program on the system. Or they could be real users that actually log in.

A list of all the groups in the system along with the membership for those groups is in a file under the et cetera folder called group. And I'll use less. We can take a look at that file as well.

So this will just be a big laundry list of all the different groups. And right next to the group will be a list of the membership. So for example, in the adm, or admin group for short, you have the syslog user and ubuntu users are both in that group.

If we scroll down a little bit further, you can see that a group was created for vagrant as well, just like what we just saw. Even though vagrant is a user, it is also a group. And by default, the user with the same ID is going to be in this group. So vagrant is going to be in a group also called vagrant.

Normally, when you create a user account that has a login on a Unix system, it creates a home directory for that user automatically. And we can navigate into the home directory and see all the different users that have their own home directories there. If you're on a Macintosh, this is usually called the user's directory. But here it's called a home.

And so under the home folder, under the root, we have a bunch of different users. And notice that the owner and group for the folders are the users themselves. So we have ubuntu, which is created for us automatically with Ubuntu systems, and vagrant, which was created by the Vagrant system.

And if we navigate into the vagrant folder and take a look at it, notice that it contains all the different DOT files that are specific to this user like our bashrc and profile. And anything else that we want to be specific to this user we can put into this folder we can get to the home directory very quickly by using change directory and there till the operator which takes us right into our own a home directory.