I'm a newb and am trying to understand the following scenario, where I create a file as root and take over ownership as a regular user, which I wouldn't think I should be able to do. Recreation:
- [root@mybox test]#touch root.txt
- [root@mybox test]#chmod 700 root.txt
- Log in on another tty as regular user "reguser".
- [reguser@mybox test]#vi root.txt
- I can edit the file, then try to save with :wq and get warned that file is read-only.
- I am prompted to overwrite with !, so I enter :wq!
- [reguser@mybox test]$ ls -l shows that reguser now owns root.txt
What gives? I can take over any root-owned file with a regular user? Yes, the directory /test that I am in is public.