I have already looked at similar posts in this forum related to bad interpreter and denied permissions, and was unable to find a solution to this problem.

I have a vps Linux x64 (v2.6.18; CentOS 6.7). I am working on a particular project (OpenClinica) for a client and I need to install Postgresql version 8.4 (old version, I know) directly from a .bin file. The file looks like postgresql-8.4.1-1-linux-x64.bin. As far as I understood, this .bin file creates some .sh files on /tmp/postgresql_installer/.

I was also told that this file works OK and has already successfully performed installations of Postgres on many other Linux (CentOS) systems running OpenClinica.

When I run it as root at the command line typing this

./postgresql* --mode text

I get the frustrating message below.

Error running /tmp/postgresql_installer/getlocales.sh  : 
/bin/sh: /tmp/postgresql_installer/getlocales.sh: 
/bin/sh: bad interpreter: Permission denied

What I have already checked (looking in this and other forums)

  1. the first line of getlocales.sh has #!/bin/sh in it

  2. there is a link sh -> bash* at /bin

    root@vps [/bin]# ls -l sh
    lrwxrwxrwx 1 root root 4 Nov 14 12:29 sh -> bash*
  3. sestatus is DISABLED

  4. I gave chmod x permission to postgres*.bin before I ran it.

  5. I have even tried to run postgres*.bin from ~/ with no success.

Any ideas?

  • 2
    Have you forbidden executables files in the /tmp dir? Nov 14, 2015 at 21:12
  • What do you get from echo postgresql* in the directory you are running it from?
    – Jeff Schaller
    Nov 14, 2015 at 21:15
  • 2
    please show output of sed -n 1l /tmp/postgresql_installer/getlocales.sh - does that end with \r$? was the script edited or created on a windows machine?
    – cas
    Nov 14, 2015 at 21:18
  • That would result into "No such file or directory". I just remounted noexec my /tmp and it also ends up with "Permission denied" when trying to run scripts from it. Perhaps OP has same setup.
    – user140866
    Nov 15, 2015 at 0:59
  • To @RuiFRibeiro: in /tmp/postgresql_installer there are only 3 .sh files and all have x permission.
    – Newbie186
    Nov 15, 2015 at 18:35

2 Answers 2


As said, the problem was having /tmp mounted with noexec. The explanation is quite simple, some install scripts uncompress executables/scripts at /tmp and then try to run them.

I actually stumbled on this problem too by chance some moons ago, when I changed in a couple of servers /tmp to be noexec for security reasons, and then the install/update scripts of some Debian packages stopped working. As I had changed it on purpose it was quite easy to identify the problem at the time.

I still think it is a good idea to set /tmp to noexec in public webservers, however until now I have not researched much how to get around this particular problem.


Based on Rui's answer, I executed the below-mentioned command; it works for me.

mount -o remount,exec /tmp

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.