There are a couple of options,
Option 1
Add group2 as a secondary group for all the group1 users:
Code:
for user in $(groupmems -g group1 -l)
do
usermod -a -G group2 $user
done
Add group sticky bit to relevant directories:
Code:
chmod g+s <directory>
.. this ensures that the group owning the directory will also be the owner of any files created in it, but group1 will have the same permissions as group2.
Option 2
Use setfacl to add permissions for group1 to the relevant directory
Code:
setfacl -R -m group:group1:rwx <directory>
.. this will allow group1 to have different permissions than group2 to the same files
Ensure acl support is present for the file system:
Code:
grep <partition> /etc/mtab
... and look for user_xattr.
Please note that both of these options are based on file system permissions tied to specific directories.