Strange Behaviour When Using Sudo+sh+executable.

Home » CentOS » Strange Behaviour When Using Sudo+sh+executable.
CentOS 2 Comments

Hi All.

I am trying to install some software. Part of its installation is an invocation of command similar to:

# sudo -H -E -u postgres /bin/bash -c /usr/bin/python2.7
/bin/bash: /usr/bin/python2.7: Permission denied

From my perspective:
# ls -l /bin/bash /usr/bin/python2.7
-rwxr-xr-x. 1 root root 960376 Jul 8 2015 /bin/bash
-rwxr-xr-x. 1 root root 7136 Oct 11 2015 /usr/bin/python2.7

# su – postgres Last login: Tue Sep 6 11:51:45 CEST 2016 on pts/6
-sh-4.2$ /bin/bash -c /usr/bin/python2.7
Python 2.7.5 (default, Oct 11 2015, 17:47:16)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

I tried the same for /bin/top. From my perspective this is quite a strange behaviour. Can someone help with this problem?

BR, Rafal.

2 thoughts on - Strange Behaviour When Using Sudo+sh+executable.