I have an unusual problem and I'm not familiar enough with Linux permissions to solve it myself.
I've been given a bash script that creates a new folder inside
/sys/kernel/config/usb_gadget, then to create other folders and files inside it. Without being root, this isn't allowed.
I tried using
chmod to give my user full access to the usb_gadget folder, but:
- This resets when the machine is rebooted.
- My user can create a folder inside usb_gadget, but that folder doesn't give me sufficient permissions.
Only my user can create a folder only with name
myfolder inside usb_gadget. Within that folder, the user can do whatever they need to do. Even better, certain elements of that folder are also preset and the user cannot do anything with those either.
Or, give my user the ability only to run the bash script, and the bash script the ability to make the changes it needs as sudo.
What's a smart way to go about this that doesn't take an axe to security?