Hi, I have a User1 belonging to primarygroup Group1 in linux. I want to execute the command in the context of User1 and Group2 (not Group1) in one line. Any way to do that ?
One way to do that in multiple steps is to
1) First get into User1 context by running "su user1"
2) Then from User1 context execute command by running "sg group2 -c cmd".
Is there anyway to accomplish this in one step ? Running Point (2) is also prompting for group password. If this can be done from script please let me know how. Thanks !