02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Creating and Managing Groups

In the last few lessons we talked about user permissions, group permissions, adding and removing users and so forth. In this session we want to focus on creating a new group as we connect the dots with all the other commands we learned in the last few lessons.

We will use the groupadd command. Let's see it in action as we create the admin group:

groupadd admin

The process to delete this new group is easy as well:

groupdel admin 

and last reminder, the way we add the user demo into the group admin is:

usermod -a -G admin demo

To view all the members of a group type this command:

groups demo

Video Transcript

00:00In the last few videos,
00:01we've been talking about user permissions and group permissions,
00:05and in general, these are really critical for any admin,
00:08for any one that wants to manage a website.
00:11You need to get and understand how these things work.
00:14The next thing we want to talk about is how to create a new group,
00:17and we'll go through the process of setting up a group with Visudu again,
00:21and we'll have a little bit of a practice as we're learning something new.
00:25By the way, all these commands that I'm doing,
00:27I'm still doing from the root,
00:29so I don't have to add anything to it.
00:32I'm directly adding these commands.
00:34In a future video, once we walk out of the root account,
00:38and never come back into it,
00:39we'll see what we have to do to access root element commands.
00:43All right, so let's get started.
00:45So step one is we want to set here,
00:47we want to type group add,
00:49because I want to add a new group.
00:51Now, I just want to give that new group a name,
00:53so let's say I'm going to call this admin.
00:55That will be the name of my new group.
00:58So if I type your enter, I have just created a new group.
01:01If I want to delete this group, it's just as simple.
01:04I just do group del,
01:07and I type in the name of the group admin.
01:10So now I've added a group and I've removed the group, very simple.
01:14So next step is let's say we want to keep this group,
01:18so I'm going to add this group in one more time.
01:20So now we have this group that's called admin,
01:22and I want to add my user demo into this group.
01:26Remember how we do that?
01:27So the steps involved with adding a user into a group were,
01:33anyone remembers, because I don't?
01:37The steps involved with adding a user into a group
01:40is basically typing that user mod, right?
01:43Remember that user mod, and we set it minus A, minus G,
01:48but we always want to put both of them, uppercase G,
01:50and then we say what group do we want to add the user into?
01:53We want to add the user into the group admin,
01:56and what access level, or sorry,
01:58what user do we want to add it to?
01:59We want to add it to the user demo,
02:02and that's all we have to do
02:03to add the user into that group.
02:05And again, if we wanted to test and see
02:07if the user is in the group and what groups is the user,
02:11all we have to do is type the word groups,
02:13the command groups, and type inside the user,
02:16and it would list out the groups that the user is in,
02:18and you could see that the user demo is in the admin group.
02:23The next step that we want to do
02:24is we want to create a new group rules.
02:28What access does this group have?
02:30And to do that again, we want to hit that vZooDoo,
02:32so we're going to type inside of the user, sbin,
02:41and we want to go into that vZooDoo,
02:44and we're going to go right inside there,
02:45and again, scroll all the way to the bottom,
02:48find our group settings,
02:50and it's time for us to add a new group.
02:52And again, we want to give this group complete access,
02:55so all we have to do is just find that group,
02:57and we could add that group, and by the way,
03:00we could add the group, and what no password
03:03or with password is, and I want you to want to compare
03:05between these two, same thing without a password.
03:08How about we do this only with a password in this one?
03:10So I'm just going to go right here and type on the A
03:14so I could start editing,
03:15and I could put inside here the group admin,
03:19and I want to add all, I want to give them an all access.
03:26Means all servers could access this,
03:28but we have only one server,
03:29so we don't have to worry about it,
03:31and we want to give the admins right to all the users
03:33in the server, in this configuration,
03:37and we want to give it access
03:38to all the different applications.
03:39Now, if we wanted to, we could also say,
03:41hey, we trust this user so much,
03:44and we trust ourselves so we won't make mistakes,
03:47and we could type here no password.
03:50Now, what no password actually means,
03:52it means that when the users,
03:54when the user is going to,
03:56that is inside of the group admin,
03:58is going to do stuff that only admin right access
04:01to all the root access when they're doing things,
04:03it's not going to ask for a password
04:05every single time they're trying to do a command,
04:07and it's really just down to a question of,
04:10do you want to have more protection?
04:12Meaning every time you're doing something
04:14that means you're changing something on the system,
04:16you have to type inside a password or you don't,
04:19and that's really just the configuration,
04:21just the question you want to ask yourself
04:23if you want to do either or the other,
04:26and that covers really everything
04:29I had to talk about, groups,
04:30that's all we're really going to talk about, groups.
04:32We have just a little bit more extra stuff
04:35that we're going to talk, and let me just save this,
04:36I'm going to click on Escape,
04:37and again, I'm going to type Shift ZZ,
04:41and it's going to save our application,
04:43and now we have this new group,
04:46and this group has access to everything,
04:48and our user demo has access to, so it has root access,
04:51not only is it root, it's also a root
04:53that does not need to type in a password every single time,
04:56and it's really just a question of how safe
04:58and how comfortable you feel as you're working,
05:00and if you want to do those type of commands
05:02where there is no regrets once you type something,
05:04so if you try to delete a folder
05:06that is not inside of your normal access,
05:08then it doesn't ask for a password.
05:10I personally recommend keeping the password,
05:12because it's not like you're sitting all day long
05:14doing commands inside of your Linux,
05:16if you are, maybe, then you don't need it,
05:18but in general, it's a great idea
05:20to have a moment to pause and say,
05:21hey, are you really sure?
05:23Which is the moment where you're putting in that password,
05:25basically confirming that this is exactly
05:27what you want to do, and it's also in case
05:29someone logs into your account,
05:31or if you left your computer open,
05:32and then someone goes inside and creates some damage,
05:35they always have to type in their password,
05:37which is not a bad solution.
05:39So, I probably would remove it,
05:41so I'd probably go back into the Visudu,
05:43go back, find that, and maybe comment it out,
05:45which is probably what I'm gonna do right now.
05:47In the next video, I wanna talk to you
05:48just a little bit more about users,
05:50so I'm gonna delete this, and I'm gonna meet you
05:52in the next video, where we're gonna be talking
05:54about a little bit more about what other stuff
05:57could you do with users, and that's gonna cover
05:58all of our conversation about users,
06:00and we'll be ready to move on to the next topic.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!