Trying to modify /proc/sys/vm/overcommit_memory, but getting permission denied even with sudo
Matthew Barrera
I am trying to edit the file /proc/sys/vm/overcommit_memory, but I'm getting permission denied even if I use sudo or switch to root user via sudo -i and try to edit using that account. How can I get this to work?
2 Answers
Instead of using sudo -i and then using echo, just pipe echo to sudo tee instead like this:
echo 1 | sudo tee /proc/sys/vm/overcommit_memory 2 I found my answer here. I was trying to use vim to edit the file while in root user mode, but it turns out you can't do that since the file is virtual. Instead, I used echo 1 >/proc/sys/vm/overcommit_memory