I can't execute a script.
I'm struggling with this.
OS version and hardware model
I'm on Raspbian GNU/Linux 10, Raspberry Pi 3 Model B.
Devices
When I call lsblk
I get:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
└─sda1 8:1 0 465.8G 0 part /mnt/hd
mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 29.5G 0 part /
File permissions:
When I call ls -la
on /mnt/hd
I get:
$ ls -la
total 124
drwxr-xr-x 7 user user 4096 May 3 02:52 .
drwxr-xr-x 3 root root 4096 Mar 29 13:26 ..
...
-rwxr-xr-x 1 user user 49 Apr 30 01:32 start.sh
...
File system information
$ file -sL /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=dd7c2097-d7cf-4784-bc0f-e8daa9b681ec (extents) (64bit) (large files) (huge files)
Fstab entry:
HDD is mounted on boot with an /etc/fstab
entry:
/dev/sda1 /mnt/hd auto defaults,user 0 1
Execution
I do have execution permission, but still when I try to execute start.sh
:
$ ./start.sh
-bash: ./start.sh: Permission denied
Script contents
$ cat start.sh
ls
Even though it shows me Permission denied
.
What I'm missing here?
user
in fstab impliesnoexec
, so addexec
afteruser
... i.e./dev/sda1 /mnt/hd auto defaults,user,exec 0 1
sh start.sh
(or your favorite shell interpreter) as the script is just a text file and the interpreter is on another partition (just found it based on your tip). Thanks again for your attention!