I am looking for something like sudo (or something that can be run from sudo) that allows me to run a program with my uid and primary gid, but with an additional supplementary group.
Warning #1: this is an alternative 'hacky' approach.
Warning #2: not all applications/script might be able to handle this ambiguous uid/gid.
Create a new user with the same uid and gid, by using
You should then run the program as this new user. I suggest to debug it using
It is not clear if you want that the additional group become as if it would be the primary group, i.e., the group of all new files created; or if this group is not even a seconday group of that user.
In first case, if you are already a member of that group, you may use two different commands "newgrp" and "sg". Both accomplish the same result, but one execute an interactive shell with the new gid, while the second one only execute a command.
In the second case, you should setup a password for the group using command groupadd or groupmod, then, again, when using "newgrp" or "sg" you will be prompted for that password before executing the command.
Another different, and simpler, approach, is to change the group owner of your executable, ad set its setgid bit. More information about this bit is on the man page for chmod.