Reputation: 1035
I have a module i created in linux kernel. I want the module to receive parameters, and i want one of them to have reading and writing permissions. So i defined :
module_param(param, int, S_IWUSR|S_IRUGO);
But for some reason when i go to /sys/module/mymodule/paramter/param and try to write to it does not give me permission (even using sudo)
Upvotes: 2
Views: 2074
Reputation: 4084
Do you use sudo
with echo
like
sudo echo 1 > /sys/module/mymodule/paramter/param
this?
Redirection to a file does not work with sudo
. Use e.g. tee
instead:
echo 1|sudo tee /sys/module/mymodule/paramter/param
That way you can write to a file as root.
Apart from that, your module_param()
call looks good.
Upvotes: 2