Cannot execute file, permission denied

General support questions
Post Reply
dah_lala
Posts: 12
Joined: 2014/06/23 17:57:28

Cannot execute file, permission denied

Post by dah_lala » 2018/09/26 07:22:05

Hi all,

Recently I upgraded my Server to CentOS 7.5 and configured a new RAID5 (mdadm), which I am mounting via automount on the server:

Code: Select all

#/etc/auto.master:
/-	/etc/auto.fstab --timeout=600,defaults

#/etc/auto.fstab:
/RAID   -fstype=auto,users	 UUID=66eef769-25d0-4143-850b-ef1743a301d0
I exported the mountpoint as NFS share and mounted it on various machines (CentOS 7.5 and RHEL 7.5). Everything works perfectly fine and I can read, write, and execute files on these client machines:

Code: Select all

user@Client:/NFS_mount/scripts$ ll test
-rwxrwxrwx. 1 user user 25 Sep 25 23:50 test
user@Client:/NFS_mount/scripts$ ./test
test
The script ./test contains:

Code: Select all

#!/bin/bash
echo "test"
However, on the server itself I am unable to execute the same files (even as root):

Code: Select all

[root@Server scripts]# ll test
-rwxrwxrwx. 1 user user 25 Sep 25 23:50 test
[root@Server scripts]# ./test
bash: ./test: Permission denied
I didn't set a noexec option in the autofs config file.

What's wrong?
Thanks a lot!

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Cannot execute file, permission denied

Post by hunter86_bg » 2018/09/27 17:42:29

What is the output of

Code: Select all

/bin/bash /path/to/test
ls -Zl /path/to/test   

dah_lala
Posts: 12
Joined: 2014/06/23 17:57:28

Re: Cannot execute file, permission denied

Post by dah_lala » 2018/09/28 06:29:04

Thanks for your response!

The output is interesting!

Code: Select all

user@Server:/path/to$ /bin/bash /path/to/test
test
user@Server:/path/to$ ./test
-bash: ./test: Permission denied
user@Server:/path/to$ bash test 
test
user@Server:/path/to$ ls -Zl /path/to/test
-rwxrwxrwx. 1 unconfined_u:object_r:unlabeled_t:s0 user user 25 Sep 25 23:50 /path/to/test

user@Server:/path/to$ su
Password: 
[root@Server scripts]# /bin/bash /path/to/test
test
[root@Server scripts]# ./test
bash: ./test: Permission denied
[root@Server scripts]# ls -Zl /path/to/test
-rwxrwxrwx. 1 unconfined_u:object_r:unlabeled_t:s0 user user 25 Sep 25 23:50 /path/to/test
From the Client:

Code: Select all

user@Client:/NFS_mount/to$ ./test
test
user@Client:/NFS_mount/to$ /bin/bash /NFS_mount/to/test
test
user@Client:/NFS_mount/to$ ls -Zl /NFS_mount/to/test
-rwxrwxrwx. 1 system_u:object_r:nfs_t:s0       user user 25 Sep 25 23:50 /NFS_mount/to/test
So this is some kind of security issue?
How can I change this?

Thanks!

dah_lala
Posts: 12
Joined: 2014/06/23 17:57:28

Re: Cannot execute file, permission denied

Post by dah_lala » 2018/09/30 20:29:47

Its the same when I mount the RAID device directly via an fstab entry.
If I copy the script to another drive I can execute it ... any ideas? :(

dah_lala
Posts: 12
Joined: 2014/06/23 17:57:28

Re: Cannot execute file, permission denied

Post by dah_lala » 2018/09/30 21:26:16

ok found it ...
had to set the exec option in the autofs config file... obviously it's noexec by default

Post Reply