Compiling a simple program in Ubuntu 16.04 with gcc-5.4.0:
$ cat tmp.c
#include <stdio.h>
int main()
{
printf("Hello World");
}
Yields the following error when trying to compile as a non-privileged user:
$ gcc tmp.c
gcc: error trying to exec 'as': execvp: Permission denied
If I look at the permissions of the assembler, as:
$ ls -lt /usr/bin/as
lrwxrwxrwx 1 root root 19 Aug 30 09:39 /usr/bin/as -> x86_64-linux-gnu-as
$ ls -lt /usr/bin/x86_64-linux-gnu-as
-rwxr-x--- 1 root root 369480 Aug 30 09:39 /usr/bin/x86_64-linux-gnu-as
This is very strange. I can compile this program as root without the error.
QUESTION:
Why is the assembler have 750 permissions? How would it have gotten into this state. I can't imagine that Ubuntu comes like this by default.
chmodcommand. Perhaps time to reinstall thebinutilspackage?chmodand it's not just Ubuntu 16.04. As a result, non-root users are getting/usr/bin/gcc: Permission denied.# namei -om /usr/bin/gcc ... lrwxrwxrwx root root gcc -> gcc-7 lrwxrwxrwx root root gcc-7 -> x86_64-linux-gnu-gcc-7 -rwxr-x--- root dev x86_64-linux-gnu-gcc-7. This is so strange to me. Does anyone know why it doesn't have o+x permissions?gccrather thanasthat the OP had, but very similar. For comparison,g++is runnable by any user.namei -om=>-rwxr-xr-x root root x86_64-linux-gnu-g++-7. And$ which g++ /usr/bin/g++ $ which gcc # nothing