Reasons for Permission denied on execution

Vlad Nicola asked:

I have a binary executable that I am able to run on my CentOS7 machine. I scp it to another CentOS7 machine and get Permission denied when trying to run it. I am using the root user, the file is owned by root and I have enabled all permissions (and same with the directory where I put it):

# ls -lisa notserv 
5112112 35292 -rwxrwxrwx 1 root root 36136938 Sep 14 08:23 notserv
# ls -lisad .
5112110 4 drwxrwxrwx 3 root root 4096 Sep 14 08:23 .
# ./notserv 
-bash: ./notserv: Permission denied

SELinux is not enabled:

# sestatus
SELinux status:                 disabled

This other machine is maintained by a different team in the company and probably has a different configuration. My question is: what other reasons could there be for this outcome?


I am using partition /tmp which does not seem to have the noexec flag set:

# pwd
# mount | grep /tmp
/dev/md126p8 on /tmp type ext4 (rw,nosuid,nodev,noatime,data=ordered)


Some more info about the file and the OS:

# file notserv 
notserv: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, BuildID[sha1]=7d5c9389a3c67ff50f9a16be3e47efd32f57e2c7, not stripped

# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID_LIKE="rhel fedora"
PRETTY_NAME="CentOS Linux 7 (Core)"


# uname -a
Linux oms0 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

As for ldd:

# ldd notserv 
     not a dynamic executable

BUT, on the original machine it says:

# ldd notserv =>  (0xf772f000) => /lib/ (0xf76fd000) => /lib/ (0xf76e2000) => /lib/ (0xf75f6000) => /lib/ (0xf75b4000) => /lib/ (0xf7598000) => /lib/ (0xf73cd000)
     /lib/ (0xf7730000)

My answer:

You are trying to run a 32-bit binary on a 64-bit system, but your system does not have the 32-bit C library (glibc) or any other 32-bit libraries installed.

You can install the necessary 32-bit compatibility libraries:

yum install glibc.i686 libstdc++.i686

Now you should be able to run the program.

Alternately, you can try to obtain a 64-bit binary from the source who provided this binary to you.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.