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?

EDIT

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

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

EDIT2

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="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

# 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 
     linux-gate.so.1 =>  (0xf772f000)
     libdl.so.2 => /lib/libdl.so.2 (0xf76fd000)
     libpthread.so.0 => /lib/libpthread.so.0 (0xf76e2000)
     libstdc++.so.6 => /lib/libstdc++.so.6 (0xf75f6000)
     libm.so.6 => /lib/libm.so.6 (0xf75b4000)
     libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7598000)
     libc.so.6 => /lib/libc.so.6 (0xf73cd000)
     /lib/ld-linux.so.2 (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.