Nerdrium Home



Web Design

Case Mods





My Blog




Creating Groups

by Michael Greifenkamp (August 12th, 2003)

So on a galactic scale, I'm very, very new to Linux. Sure, I took a class, and yes, I understand how basic commands work. And I can follow along well enough to do things like installing and configuring Apache and PHP. But I'm a newbie with a capital N. (For example, when I change ownership on a file I can't ever remember if I do chown username filename or chown filename username....)

At any rate, my friend Jeff is learning Linux as well, so that he can administer a website that he maintains. Last night he asked me how to create a new group. And it occurred to me that I didn't really know. The only time I ever created a new group I cheated and used Gnome. :O

So, I attempted to figure it out today. It was a bit tricky for me to find out how, since typing "Linux create group" in Google returns a listing of every Linux User Group in the world. (Believe it or not, the way I eventually found out was by going to and searching for "create group" in their newbie Unix forum area!)

Use the groupadd command.

Here's what I did, after signing in as superuser first, of course, using su -l.

groupadd dorks

This adds the new group "dorks" to the /etc/group file. But it doesn't put anyone in the group. To do that you need to edit the /etc/group file. Still as superuser:

cd /etc/
vi group

Scroll all the way to the bottom of the file where you should see:

dorks:x:505: (the number probably won't be the same--you can add an argument to the groupadd dorks line to specify a group number if you really want to, but unless you really care what the number is, don't specify one and the Linux deities will assign one for you.)

At any rate, go to the end of that line and hit the "i" key so that you can insert text. Then simply type the usernames that you want added to that group. When you're finished that line might read something like this:


Hit the escape key to get out of insert mode, and then type :w (enter) to write the file and then :q (enter) to quit vi.

And that's it! Your new group is created and has users added to it. I don't know exactly why, but I had to exit the shell program I was using and sign back in again before I was recognized as being a part of the group that I had created (again, I'm a Linux newbie and don't exactly understand how all of this stuff works).

Have fun!