Results 1 to 3 of 3

Thread: Putting multiple users in one group in one shot

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Putting multiple users in one group in one shot

    Hello, to everybody,

    Suppose, in an organization there are 500 users. I have created one new group, let say the group is xyzabcd. I want to add about 100 users (having UID starting from 600 to 700) to that newly created group. How do I go about it?

    Using usermod command I can add one user at a time to that newly created group. But I don't want to type the command for each and very user again and again. So please help me out with this situation. If with the help of script we can do this, then kindly help me out with such script, as I know little about writing the script.

    Thanks in advance.

    Regards,

    Hrishikesh

  2. #2
    Member
    Join Date
    Feb 2008
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    7

    Default

    Try something like this:

    Code:
    # for user in `awk -F':' '$3 >= 600 && $3 <= 700 { print $1 }' /etc/passwd`; do
    > usermod -G mygroup $user
    > done

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Thanks a lot, its great!. Got satisfied.

    Thanks!

    Regards,

    Hrishikesh

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add multiple users to a group
    By chuckbeattie in forum Linux software
    Replies: 2
    Last Post: 2nd November 2007, 11:04 PM
  2. set up e-mail group
    By karpos in forum Mail Servers
    Replies: 1
    Last Post: 1st June 2007, 12:28 AM
  3. Script to add users to multiple servers.
    By deepakhg in forum Shell scripting
    Replies: 0
    Last Post: 17th March 2007, 03:02 AM
  4. Group Policy
    By bubloob_13 in forum Windows Xp/2000/2003 server administration
    Replies: 0
    Last Post: 31st January 2007, 02:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •