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
andchown
, for examplesudo chmod 755 /dev/sdX
orsudo chown mrowsell /mnt/SCHOOL
and many variations thereupon (which, as stated, won't work)umount
andremount
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
called99-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 theumount
/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.
bash myscript ....
? – Rmano Mar 09 '15 at 17:00fstab
... Have a look at the link below. – Fabby Mar 12 '15 at 23:02