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.
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.
My previous post was made a long time ago, so here is a draft that I finally decide to post. Let’s see how to secure some of your data with an encrypted block device using losetup and dd.
Steps will be :
- Create an image with dd
- Build a new device using the image with an encrypt algorythm by using losetup
- Format the device using mkfs.ext3
- Mount the device and start using it !
Of course, when you have mounted the device, your data are readable to anyone who have access to the mounted directory.