Skip to content

Instantly share code, notes, and snippets.

@benoitjpnet
Created December 16, 2013 15:59
Show Gist options
  • Save benoitjpnet/7989388 to your computer and use it in GitHub Desktop.
Save benoitjpnet/7989388 to your computer and use it in GitHub Desktop.
Get the groups of an user and add another user into these groups.
for group in $(grep user1 /etc/group | cut -d':' -f1 | sed '/user1/d'); do adduser user2 $group; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment