Skip to content

run with new group credentials

Kelly (KT) Thompson edited this page Dec 9, 2019 · 1 revision

Summary

I use this small bit of code at the top of many shell scripts to ensure any artifacts generated by the script have the desired permissions.

# execute the remainder of this script as group 'foo'
if [[ $(id -gn) != foo ]]; then
  exec sg foo "$0 $*"
fi
# Full access for _User_, Read and Execute for _Group_, No access for _World_.
umask 0027