LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   change of owner and group owner of a file belongs to diff user ? (https://www.linuxquestions.org/questions/linux-security-4/change-of-owner-and-group-owner-of-a-file-belongs-to-diff-user-4175545149/)

somorg 06-12-2015 02:58 AM

change of owner and group owner of a file belongs to diff user ?
 
Can anyone explain ?

Hi,
(Red Hat Linux 7)
#mkdir /doc
#chmod 777 /doc
user1$ cd /doc
user1$ touch file1
{here the owner and group owner of the file is user1}

user2$ cd /doc
user2$ vim file1
{user2 is able to add content and save the file.}

1. After user2 edited the file1 with "vim" the owner of the file get changed why?
2. file1 was created my user1 and having 664 perm by default and user1 is the owner and groupowner of the file. How user2 was able to edit it with the file having only read perm for others ?

veerain 06-12-2015 03:24 AM

That's because /doc has read,write,exec permissions for other user. So vim creates a new file with user2 owner.

unSpawn 06-13-2015 02:33 AM

Triple duplicate post. Closed. Don't ever do that again.


All times are GMT -5. The time now is 04:41 AM.