2

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

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
pcs3rd
  • 65

1 Answers1

1

Use tee to run sudo as normal user:

echo "default-on" | sudo tee /sys/class/leds/bananapro\:green\:usr/trigger
Tuyen Pham
  • 1,805