Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

#ls -l
-rwxr-xr-x. 1 root root 1894 Feb  2 01:58*
-bash: ./ 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*

there is . after permissions which indicates that an SELinux security context applies to that file. so I copied 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
Copying a file is like creating a new one, so there are a couple of options. 1) Try restorecon /tmp/ after you copied it. That could work if the file context is generic enough. 2) Run ls -lZ on the original, get the context, and then set that context with 'chcon' if the first option didn't work. – Andrew Feb 4 at 22:43

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.