2

I use a mobile hard disk in ubuntu and I want to run scripts on the disk. At first, the permission is denied. Therefore, I followed the advices in this answer How do I use 'chmod' on an NTFS (or FAT32) partition? and use

sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000,uid=scw4750,gid=scw4750 /dev/sdf1 /media/Elements

to remount the disk.

After this the permission becomes:

-rwxr-xr-x 1 scw4750 scw4750 32  6月  1 14:45 test.sh*

However, when I run test.sh with >>./test.sh

It returns:

bash: ./test.sh: Permission denied

Why do this happens? How to solve it? Thanks.

Raffa
  • 34,963

1 Answers1

2

As noted in the mount manpage, the user mount option implicitly turns on the noexec option as well

user   Allow an ordinary user to mount the filesystem.  The name of the
       mounting user is written to mtab so  that  he  can  unmount  the
       filesystem  again.   This  option  implies  the  options noexec,
       nosuid, and nodev (unless overridden by subsequent  options,  as
       in the option line user,exec,dev,suid).

where

noexec Do  not  allow  direct  execution of any binaries on the mounted
       filesystem. 
steeldriver
  • 142,475