Search code examples
linuxbashunixshellpermissions

Bash Scripting - How to set the group that new files will be created with?


I'm doing a bash shell script and I want to change the default group that new files are created as. I know you use umask to change the permissions. Is there something for the group?


Solution

  • The newgrp command is used to change the current group ID during a login session.

    New directories created in that session will have the group ID set by the command.

    newgrp(1)