Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running a script but there is an unusual warning: This is what happened in my console

#ls -l test.sh
-rwxr-xr-x. 1 root root 1894 Feb  2 01:58 test.sh*
-bash: ./test.sh: Permission denied

Edit: my script:

while read pass port user ip file; do
  echo "startt------------------------------------" $ip
  ping $ip -c 4
  if [ $? -eq 0 ]; then
    echo $ip ok...
    echo $ip failed...
  echo "finish------------------------------------" $ip
done <<____HERE
pass  22  root  test.txt

any idea? thank you

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I am running the script in /tmp directory as you see the result of ls is:

-rwxr-xr-x. 1 root root 1894 Feb  2 01:58 test.sh*

there is . after permissions which indicates that an SELinux security context applies to that file. so I copied test.sh in a directory else...

the problem was solved

I was in a directory where it might be a bad idea for executables to reside

ls -l /
drwxrwxrwt.   8 root root  1024 Feb  2 07:44 tmp/

These may work as well:

setenforce 0 | reboot


echo 0 > /selinux/enforce | reboot


putting SELINUX=disabled in /etc/selinux/config and reboot (making sure to comment out anything in that file enabling selinux)

SELINUX status: sestatus

share|improve this answer
Disabling SElinux just to run a script might not be a good idea... –  Wilf Feb 2 '14 at 8:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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