When you attempt to modify a file without write permission on it, you will end-up with a
permission denied error.
$ touch donottouch.txt && sudo chown root donottouch.txt $ cat donottouch.txt $ echo "change stuff" > donottouch.txt -bash: donottouch.txt: Permission denied
Using sudo before echo won't help since the redirection will still apply within your shell environment. Here is few approaches to this problem.
If you haven't been away of the internet for the past few years or if you are an occasional blogger, you must have heard about Markdown
Frequently when I setup a new server (or a bunch of them) I use a small shell script that will go thru all the basic linux sysctl config. I decied to share it. I always change it a bit according to my needs and the application/services that will run on the server. Though having a script to automate some of this manual tuning is quite useful. Use it at your OWN risk. There is no silver bullet, make sure to understand each parameters and that they fit your needs/usage/network/OS.