I'm trying to execute some scripts, which are located on my data partition, from the shell, but I have a problem with permissions.

bash: /media/storage/ss/script.py: Permission denied

Before running I provided the script execute permission with:

chmod +x script.py

Likely the problem is related to settings in my fstab-file. I have tried to edit my /etc/fstab settings. Currently they are:

UUID=F6C09DB5C09D7C95 /media/storage/    ntfs-3g uid=1000,gid=1000,umask=0022,auto,rw 0 0

However I cannot see these updated uid and gid when I run:


~$ stat /media/storage


  File: /media/storage/
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 804h/2052d  Inode: 5           Links: 1
Access: (0777/drwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)

So how do I change my /etc/fstab file to have execute permission on my scripts on my ntfs data partition?

-- Edit --

~$ stat /media/storage/ss/script.py


  File: /media/storage/ss/script.py
  Size: 525         Blocks: 2          IO Block: 4096   regular file
Device: 804h/2052d  Inode: 10208       Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-03-13 13:17:31.980325600 +0000
Modify: 2019-03-13 13:14:11.690160100 +0000
Change: 2019-03-13 13:14:11.690160100 +0000
 Birth: -

And when I run:

~$ head -n 1 /media/storage/ss/script.py


 #! /usr/bin/env python

And when I run:

mount | grep /media/storage


/dev/sda4 on /media/storage type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,allow_other,blksize=4096,user)


  • 1
    Err, stat /media isn't really interesting if your fstab entry is for /media/storage. That being said, stat /media/storage/ss/script.py and head -n 1 /media/storage/ss/script.py could provide some additional information. – Zeta Mar 20 at 16:03
  • Ahh, true. Thank you for the suggestion. I have edited my stat command. – florisrc Mar 20 at 16:19
  • Thanks! Could you also add mount | grep /media/storage to show the actual set of options? Note that you don't need do add edit to your question, though, there is a revision log. – Zeta Mar 20 at 16:24
  • Thank you for your quick reply. I have added the output above. – florisrc Mar 20 at 16:45

You've mounted /media/storage as noexec. noexec does not allow executing any binaries on the mounted file system (see man 8 mount).

You have to specify exec as mount option in your fstab. Note that your fstab entry is also missing the defaults option (see also man 5 fstab). You probably want something akin to

UUID=F6C09DB5C09D7C95 /media/storage/    ntfs-3g defaults,uid=1000,gid=1000,umask=0022 0 0

Check man 5 fstab or man 8 mount for the meaning of defaults. At least on my system, it's the same as


but that depends on the file system.

If you want to check this without changing your fstab, try

mount -o remount,exec /media/storage/ 

first to remount /media/storage/ with executable permissions and check your script again.

  • Thank you for your help. Mentioning the remount was a really useful hint/suggestion! – florisrc Mar 21 at 10:14

I assumed that a reboot would mount the data partition according to the edited /etc/fstab settings. However, that does not seem to be the case.

After running:

sudo mount -a

the problem was solved. Now I'm able to execute scripts on my data partition from the shell.

The result of stat /media/storage is now:

  File: /media/storage
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 804h/2052d  Inode: 5           Links: 1
Access: (0755/drwxr-xr-x)  Uid: ( 1000/  floris)   Gid: ( 1000/  floris)

I'll try to figure out what would be my appropriate /etc/fstab configuration, but my execute problem is solved.


As you are trying to exclude executable permissions on directories? Try using separate values for file mask fmask=0111 (fmask only applies to files, not directories) and directory mask dmask=0777 (applies to directories)

  • 1
    "As you are trying to exclude executable permissions on directories..."? Where do you see that in either question or configuration? – Zeta Mar 20 at 16:05
  • @ Zeta Actually I was not sure so asked for confirmation and based on assumption provided the recommendation – Nur Mar 20 at 17:31
  • That's what comments are for. If you gain another 29 reputation comment everywhere. 29 reputation needs three well-received answers. – Zeta Mar 21 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.