Script to add a secondary group to all users except system default users
Hi,
Can any one help me with a script which can add a secondary group to all existing users except system users in linux. |
grep ":5[0-9]\{2\}:" /etc/group | sed "s/:$/:newgroup/"
|
Hi Admiral,
Thanks for your reply, Could you please post me a shell or Perl script if you have any for this purpose. |
Code:
#!/bin/bash |
Quote:
I've tried using this by creating a new group and running this script by specifying the group as argument, but i was unable to see the secondary group information for user in the system.I want to create a group and after that by running the script it should make the newly created group as secondary group to all existing users except the system default user. Could you please help me here.... Thanks in advance |
Code:
#!/bin/bash Use the 'groupadd' command to add the group you want. Type 'man groupadd' to figure out how to use it. To add that new group to all 'normal users', run '<script> NewGroup'. If you like the output, make a backup copy of /etc/group and copy /etc/group.new over /etc/group. Feel free to ask me about the regular expression used to find the normal users in the group file (if you're interested) and I'll try and explain. |
All times are GMT -5. The time now is 10:46 AM. |