I have a problem, during write something into a root file:$ ll /sys/bus/usb/devices/3-2/power/wakeup-rw-r--r-- 1 root root 4096 Feb 16 17:28 /sys/bus/usb/devices/3-2/power/wakeup$ sudo echo disabled > /sys/bus/usb/devices/3-2/power/wakeupbash: /sys/bus/usb/devices/3-2/power/wakeup: Permission deniedeven it did not ask me for password. How can I solve this?Why I can't use sudo directly?
sudo issue during echo something to a root file
sudo;echo
You cannot use sudo with redirection, because the redirection is done by your original shell which runs as your own user code. It tries to set up a file descriptor for the file mentioned after the >, which fails as your user is not able to write to it.Costas's method works, as does spawning a subshell:sudo sh -c echo disabled > /sys/bus/usb/device/3-2/power/wakeup