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,264
  • 56
  • 94
  • 147
Aurelius
  • 353
  • 1
  • 3
  • 11
  • 2
    Please [edit] your question to include the error messages you get when you issue the commands you put in your question. These might mean nothing to you, but are necessary for us to resolve your issue. Help us help you! Thank you. "didn't work" isn't helpful unfortunately. – Elder Geek Mar 09 '15 at 16:36
  • 2
    You can't run a script out of a vfat-formatted USB disk --- have you tried to simply run bash myscript ....? – Rmano Mar 09 '15 at 17:00
  • What @Rmano is trying to say: VFAT doesn't have any security. The only security comes from mounting it correctly in fstab... Have a look at the link below. – Fabby Mar 12 '15 at 23:02
  • @Fabby, really, no, I didn't mean that. I am saying that vfat has no executable bits so you can try call the script directly with bash avoiding the need for them. – Rmano Mar 13 '15 at 06:25

0 Answers0