Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #All the script does is create the new specified group, cuts out all the names from /etc/group #and replaces all commas with a single space. It then places each name into it's own element #inside of an array called 'users'. It then goes through each element of the users array and #adds it to the group. To execute the command, type: ./nameofscript groupname
- users=( $(cat /etc/group | cut -d: -f4 | tr ',' ' '))
- groupadd $1
- for i in ${users[@]}; do
- usermod -a -G $1 $i
- done
Advertisement
Add Comment
Please, Sign In to add comment