bashcommand linesudo
When using sudo to allow edits to files, I regularly get ‘permission denied’.
For example, my mouse is jittery and sluggish, so I want to disable polling:
sudo echo "options drm_kms_helper poll=N">/etc/modprobe.d/local.conf
I’m prompted for a password, and then get:
bash: /etc/modprobe.d/local.conf: Permission denied
So I tried to do a temporary change to disable polling by using:
sudo echo N> /sys/module/drm_kms_helper/parameters/poll
Yet again the system responded with:
bash: /sys/module/drm_kms_helper/parameters/poll: Permission denied
Any ideas?
Accepted Answer
Output redirection (via the >
operator) is done by the shell, not by echo. You have to login as root
sudo -i
Then you can use redirection
echo N> /sys/module/drm_kms_helper/parameters/poll
Otherwise you can run bash string with sudo
sudo bash -c "echo N> /sys/module/drm_kms_helper/parameters/poll"
The post How to Solve “Permission Denied” When Using Sudo With Redirection in Bash? appeared first on Stack All Flow.
Top comments (0)