1

I have read multiple other answers on here to no avail. Clearly chmod and chown are not applicable here.

Here's the problem: I have a USB drive for school in which I have a folder for my programming class, where I do all my C programming. I wrote a shell script that, when called, will create a new folder which contains a template C file and Makefile for that project, all with the name of the lab. This script works fine on my laptop at home, but because I'm unable to give it execute permissions, it won't run on the USB stick.

Here's what I've tried so far:

  • chmod and chown, for example sudo chmod 755 /dev/sdX or sudo chown mrowsell /mnt/SCHOOL and many variations thereupon (which, as stated, won't work)
  • umount and remount with -o fmask=111,dmask=000 (or the other way around, can't remember what the answer said). Also tried -o defaults,exec,noauto and many other suggested variations.
  • Create a new rule in /etc/udev/rules.d called 99-school-usb.rules. This solution required many attempts with different lines. Essentially boiled down to this:

    SUBSYSTEM !="usb_device", ACTION !="add", GOTO="school_rules_end"
    SYSFS{idVendor} =="8564", SYSFS{idProduct} =="1000", SYMLINK+="school"
    MODE="0755", OWNER="myusername", GROUP="myusergroup"
    LABEL="school_rules_end"
    
  • Of course, the VID:PID are changed to match my USB stick. This still doesn't work.

  • Add a new entry to fstab. The problem with this is that the stick may or may not be present at boot, and if it's not present it causes problems. This also doesn't work because the umount/mount option above is the same thing in a different manner.

So either I'm doing the rules.d entry incorrectly, or I'm missing something else obvious.

David Foerster
  • 36,890
  • 56
  • 97
  • 151

0 Answers0