14

I'm using Ubuntu 10.10 and using a usb drive but I'm finding that I can't chmod any programs on the drive to +x. It is being auto-mounted by Gnome (using udev, I think?) so I imagine the problem is a mount option but I can't seem to find a way to modify the default mount options any where. There are no entries in fstab. Anybody encounter this problem?

Jorge Castro
  • 71,754
asterisk
  • 143
  • 1
    If it's vfat/ntfs, you can set the default permissions with the dmask/fmask mount options mount -o umask=xxx depending on what rights you want, umask=0 will give all rights.. – karthick87 Dec 15 '10 at 10:21
  • 3
    Yes, but I can't seem to find out how to modify these options for when Gnome automounts an inserted device. I have it mounted manually to another location from an entry in /etc/fstab, so this will work for the time being, it's a bit inconvenient though. – asterisk Dec 15 '10 at 10:49
  • No EASY way in 2019?? No plug-and-play to do that with UBUNTU 18 LTS?? – Peter Krauss Aug 26 '19 at 10:22

1 Answers1

12

I guess your usb drive is formatted with VFAT/FAT32. This file format does not support execute permissions which is why chmod +x fails.

[Edit] Ok, had a bit of a play and search on the net. Lots of 'solutions' suggest that you should change /etc/fstab. This just seems clunky to me, what do you do? change fstab every time you encounter a new usb flash drive???

My solution:

$ sudo vi /etc/udev/rules.d/90-usb-disks.rules

Add the lines:

# UDEV Rules to change the permission of USB disks
#

KERNEL=="sd*[0-9]", ATTR{removable}=="1", ENV{ID_BUS}=="usb", MODE="0022"

$ sudo /etc/init.d/udev restart

Then try inserting a usb drive. There is probably an attribute that you can check for to ensure it's a FAT formatted drive if you wanted to be more specific.

JRT
  • 308