Ubuntu - Compilers - Restrict Access to Compilers

Add a compiler group

Issue the following command:

sudo /usr/sbin/groupadd compiler

…and issue the following commands:

sudo chgrp compiler *cc*
sudo chgrp compiler *++*
sudo chgrp compiler ld
sudo chgrp compiler as

…and set permissions:

sudo chmod 750 *cc*
sudo chmod 750 *++*
sudo chmod 750 ld
sudo chmod 750 as

Create a group that will access the compiler-binaries:

groupadd compilers

Change ownership of the binary you want to restrict:

chown root:compilers /usr/bin/gcc

Change permissions to be executable only by root and members of the compilers group:

chmod 0750 /usr/bin/gcc