I would like to scp a file, however my primary group does not match the permissions of the destination directory so I get a permission denied message when I try to scp. I have the correct group as a secondary group, and I can change to that group using newgrp, but it reverts when I open a new connection.

Is there a way of changing my group inside an scp call?

  • 1
    The solution proposed using sg will work, but I want to point out that it should work even without that if you have the group as a secondary group and the permissions allow write access by that group. Also by the way, you tagged your question "cgroups" which is wrong (cgroups is something else) so I will edit it.
    – Celada
    Jun 23, 2015 at 1:52
  • 1
    I'm guessing what happened is that originally, in runnning scp the secondary group wasn't there, and then the group was added later. The fact that groups aren't automatically updated in existing sessions, might explain this. Dunno though.
    – rocky
    Jun 23, 2015 at 3:36

1 Answer 1


You could wrap the scp in a sg command. For example:

sg yourgroup scp ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.