Hack 71. Create a new group and assign to an user

Create a new developer group.

# groupadd developers

Validate that the group was created successfully.

# grep developer /etc/group
developers:x:511:

Add an user to an existing group.

# useradd -G developers jsmith useradd: user jsmith exists # usermod -g developers jsmith

Validate the users group was modified successfully.

# grep jsmith /etc/passwd
jsmith:x:510:511:Oracle Developer:/home/jsmith:/bin/bash

# id jsmith
uid=510(jsmith) gid=511(developers) groups=511(developers)

# grep jsmith /etc/group
jsmith:x:510:
developers:x:511:jsmith

Comments on this entry are closed.

  • rahul May 17, 2013, 3:07 am

    Nice one..

  • wayne December 27, 2013, 1:38 am

    Thank You.