Adding users to a group by editing the /etc/group file

This final method is a good way to cheat, to speed up the process of adding multiple existing users to a group. First, just open the /etc/group file in your favorite text editor, and look for the line that defines the group to which you want to add members:

. . .
marketing:x:1005:cleopatra,maggie
. . .

So, I've already added Cleopatra and Maggie to this group. Let's edit this to add a couple more members:

. . .
marketing:x:1005:cleopatra,maggie,vicky,charlie
. . .

When you're done, save the file and exit the editor.

A groups command for each of them will show that our wee bit of cheating works just fine:

[donnie@localhost etc]$ sudo vim group

[donnie@localhost etc]$ groups vicky
vicky : vicky marketing

[donnie@localhost etc]$ groups charlie
charlie : charlie marketing
[donnie@localhost etc]$

This method is extremely handy for whenever you need to add lots of members to a group at the same time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.211.66