You are not logged in.

#1 2018-03-13 22:06:05

uhuu
Member
From: Estonia
Registered: 2010-11-22
Posts: 23

[SOLVED] btrfs permission denied when executing file

I'm running an Arch system with 4.14.22-1-lts kernel as my home server. Root disk being xfs filesystem and two data disks on btrfs RAID1.

Having a strange behaviour from my shell scripts on btrfs file systems.

any time I try to execute script with a command "sh" in front the script, it is working.
Issuing command with ./script.sh it is not and I get Permission denied.
Example:

Script1:

#!/usr/bin/env bash

echo test
echo test
sh test2.sh
./test2.sh

Script2:

#!/usr/bin/env bash

echo test2
echo test2

output

[root@xxx test]# ./test.sh
-bash: ./test.sh: Permission denied
[root@xxx test]# sh test.sh
test
test
test2
test2
test.sh: line 6: ./test2.sh: Permission denied
[root@xxx test]# ls -la
kokku 8
drwxr-xr-x 1 root   root    30 13. märts 23:51 .
drwxr-xr-x 1 nobody nobody 178 13. märts 23:43 ..
-rwxr-xr-x 1 root   root    43 13. märts 23:51 test2.sh
-rwxr-xr-x 1 root   root    64 13. märts 23:51 test.sh
[root@xxx test]# 

Scripts work fine when placed on xfs filesystem.

[root@xxx test]# ./test.sh 
test
test
test2
test2
test2
test2
[root@xxx test]# ls -la
kokku 12
drwxr-xr-x  2 root root   37 13. märts 23:56 .
drwxr-x--- 17 root root 4096 13. märts 23:56 ..
-rwxr-xr-x  1 root root   43 13. märts 23:56 test2.sh
-rwxr-xr-x  1 root root   64 13. märts 23:56 test.sh
[root@xxx test]# pwd
/root/test

Last edited by uhuu (2018-03-14 07:27:16)


Windows is not a virus, virus does something...

Offline

#2 2018-03-14 00:30:45

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: [SOLVED] btrfs permission denied when executing file

What are your mount options? See findmnt(8).

Offline

#3 2018-03-14 07:25:22

uhuu
Member
From: Estonia
Registered: 2010-11-22
Posts: 23

Re: [SOLVED] btrfs permission denied when executing file

Thanks GenkiSky for the pointer. The trouble was that I had noexec on my fstab file, it was very obvious after that smile

Problem solved!


Windows is not a virus, virus does something...

Offline

Board footer

Powered by FluxBB