This question already has an answer here:

I have a directory /sys/class/leds/ with the file bananapro\:green\:usr/trigger that controls an (green) onboard led. The contents of this file just contains the modes for the led. As root, I can run echo "default-on" > /sys/class/leds/bananapro\:green\:usr/trigger and have the led turn on. If I try to do this from a different user, I get the following responce from bash;

bash: /sys/class/leds/bananapro:green:usr/trigger: Permission denied

I have tried also running using

sudo bash -c echo "<command>"

from the non root user (with sudo access) Any recommendations on getting file permissions for users other than root

marked as duplicate by pLumo, roaima, Gilles permissions Jan 28 at 8:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Use tee to run sudo as normal user:

echo "default-on" | sudo tee /sys/class/leds/bananapro\:green\:usr/trigger

Not the answer you're looking for? Browse other questions tagged or ask your own question.