How to set up permissions to change a /sys/kernel/config/ folder?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












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:



  1. This resets when the machine is rebooted.

  2. My user can create a folder inside usb_gadget, but that folder doesn't give me sufficient permissions.

Ideal



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?







share|improve this question






















  • /sys is included in ths OS as a virtual filesystem(sysfs) which is a ram-based filesystem. It gets rebuilt at each reboot. Which is why your permissions are changed after each reboot.
    – Jaken551
    Apr 11 at 7:29










  • @Jaken551 In that case, is there a secure way to alter these permissions after /sys is set up? Plus, this doesn't seem to change the fact that even with all permissions, my user can create a subfolder but isn't given permissions to that folder either.
    – sscirrus
    Apr 11 at 16:01














up vote
0
down vote

favorite












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:



  1. This resets when the machine is rebooted.

  2. My user can create a folder inside usb_gadget, but that folder doesn't give me sufficient permissions.

Ideal



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?







share|improve this question






















  • /sys is included in ths OS as a virtual filesystem(sysfs) which is a ram-based filesystem. It gets rebuilt at each reboot. Which is why your permissions are changed after each reboot.
    – Jaken551
    Apr 11 at 7:29










  • @Jaken551 In that case, is there a secure way to alter these permissions after /sys is set up? Plus, this doesn't seem to change the fact that even with all permissions, my user can create a subfolder but isn't given permissions to that folder either.
    – sscirrus
    Apr 11 at 16:01












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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:



  1. This resets when the machine is rebooted.

  2. My user can create a folder inside usb_gadget, but that folder doesn't give me sufficient permissions.

Ideal



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?







share|improve this question














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:



  1. This resets when the machine is rebooted.

  2. My user can create a folder inside usb_gadget, but that folder doesn't give me sufficient permissions.

Ideal



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?









share|improve this question













share|improve this question




share|improve this question








edited Apr 10 at 20:55

























asked Apr 10 at 20:48









sscirrus

1484




1484











  • /sys is included in ths OS as a virtual filesystem(sysfs) which is a ram-based filesystem. It gets rebuilt at each reboot. Which is why your permissions are changed after each reboot.
    – Jaken551
    Apr 11 at 7:29










  • @Jaken551 In that case, is there a secure way to alter these permissions after /sys is set up? Plus, this doesn't seem to change the fact that even with all permissions, my user can create a subfolder but isn't given permissions to that folder either.
    – sscirrus
    Apr 11 at 16:01
















  • /sys is included in ths OS as a virtual filesystem(sysfs) which is a ram-based filesystem. It gets rebuilt at each reboot. Which is why your permissions are changed after each reboot.
    – Jaken551
    Apr 11 at 7:29










  • @Jaken551 In that case, is there a secure way to alter these permissions after /sys is set up? Plus, this doesn't seem to change the fact that even with all permissions, my user can create a subfolder but isn't given permissions to that folder either.
    – sscirrus
    Apr 11 at 16:01















/sys is included in ths OS as a virtual filesystem(sysfs) which is a ram-based filesystem. It gets rebuilt at each reboot. Which is why your permissions are changed after each reboot.
– Jaken551
Apr 11 at 7:29




/sys is included in ths OS as a virtual filesystem(sysfs) which is a ram-based filesystem. It gets rebuilt at each reboot. Which is why your permissions are changed after each reboot.
– Jaken551
Apr 11 at 7:29












@Jaken551 In that case, is there a secure way to alter these permissions after /sys is set up? Plus, this doesn't seem to change the fact that even with all permissions, my user can create a subfolder but isn't given permissions to that folder either.
– sscirrus
Apr 11 at 16:01




@Jaken551 In that case, is there a secure way to alter these permissions after /sys is set up? Plus, this doesn't seem to change the fact that even with all permissions, my user can create a subfolder but isn't given permissions to that folder either.
– sscirrus
Apr 11 at 16:01















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436863%2fhow-to-set-up-permissions-to-change-a-sys-kernel-config-folder%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436863%2fhow-to-set-up-permissions-to-change-a-sys-kernel-config-folder%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay