title: Executing command from specific user and group context in linux
body: <p>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 ?</p>
  
  <p>One way to do that in multiple steps is to </p>
  
  <p>1) First get into User1 context by running "su user1" </p>
  
  <p>2) Then from User1 context execute command by running "sg group2 -c cmd".</p>
  
  <p>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.</p>