Web Presence
| Make a file immutable |
|
|
|
| Written by JLangbridge |
| Monday, 15 June 2009 12:53 |
|
It is well know, root is master of a Linux box. He has the ultimate power, and files (and users) live and die by his command. He can do anything he wants, and with great power comes great responsibility. Sometimes too much. Who here hasn't accidentally erased a file they shouldn't have? It has happened to most of us; a quick F8 in mc or a wrong del command, and we start crying. I had a friend that dropped a database in front of me, convinced that a system was in place to protect the database against that. Wrong. Making files immutable is one way of protecting yourself on a Linux box. You can make files "immutable", meaning that even root can't modify or delete them. Try this: # chattr +i test_file This sets the immutable flag. If you want to remove the flag, just do this: # chattr -i test_file You can also check to see what flags have been written to a file by doing this: # lsattr test_file ----i-------- test_file chattr can be used for many other things, just man chattr. |
| Last Updated on Monday, 29 June 2009 20:31 |




