root@user123:~# touch 1.pwd
root@user123:~# chmod 400 1.pwd
root@user123:~# echo "abc" > 1.pwd
root@user123:~# vi 1.pwd
root@user123:~# ls -lart
total 3344
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
-rw-r--r-- 1 root root 3106 Apr 9 2018 .bashrc
drwx------ 3 root root 4096 Dec 13 13:35 .dbus
drwxr-xr-x 3 root root 4096 Dec 13 13:35 .local
drwx------ 7 root root 4096 Feb 21 10:47 .config
-rw------- 1 root root 39013 Mar 4 11:57 .bash_history
drwx------ 12 root root 4096 Mar 4 12:45 .
-r-------- 1 root root 4 Mar 4 12:45 1.pwd
root@user123:~# echo "no change" >> 1.pwd
root@user123:~# cat 1.pwd
abc
no change
The permission management successfully alters the file to read-only. Then why would writes to the file still succeed. How can I avoid this situation.
Standard permissions can be overridden by root.
Simple solution: don't use root unless you really need to do so. That way you're far less likely to delete or break something vital to the system
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments