Ubuntu 20.04, the disk partition format is EXT4.
normal user with sudo privilege, in a tmp dir, e.g: ~/tmp/
$ sudo touch c.txt
// this will create a root-root(user-group) file with mode 644, as expected.
$ rm c.txt
$ rm: remove write-protected regular empty file `c.txt'? // sys prompt
if I selected 'y', then c.txt will be removed ! // NOT as expected.
I even tried rm not-empty file, still can remove !
I tried two computers both with Ubutnu 20.04, same.
why normal user can remove root file without sudo ?
Thanks!
P.s:
After check doc on
https://help.ubuntu.com/community/FilePermissions
yes, normal user can delete any files in a full controlled directory(rwx=7), regardless file owner, modes. however, it seems that it should not apply with modfication operation. e.g:
// TC2
sudo vim d.txt // this will create a root-root(user-group) with 644 mode
vim d.txt
// edit by normal user, use w! to save in vim,
// after exit vim, the file content changed and the user-group
// chagned to current user group, not root-root anymore.
This is as expected ?