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.


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.

  • 2
    It likely would have gotten into that state by careless use of the chmod command. Perhaps time to reinstall the binutils package? Feb 18, 2019 at 16:04
  • I ran into this same issue on a new Ubuntu 18.04.3 system, so it's not just the accidental misuse of chmod and 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?
    – Tyler Rick
    Jan 9, 2020 at 0:28
  • I guess my issue is slightly different since mine is about gcc rather than as that 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
    – Tyler Rick
    Jan 9, 2020 at 0:35


Your Answer

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

Browse other questions tagged or ask your own question.