LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   How can any user remove a file created by other user with all permissions(777)? (http://www.linuxquestions.org/questions/linux-desktop-74/how-can-any-user-remove-a-file-created-by-other-user-with-all-permissions-777-a-4175467602/)

omegazafer 06-27-2013 11:12 AM

How can any user remove a file created by other user with all permissions(777)?
 
I am new on Linux using ubuntu 12.04. I created three users user1, user2, user3 in same computer.
User1 created a file in its home/general with permissions rwxrwxrwx(everyboy have all permissions). I changed the user from user1 to user2 in user1 area. I want to use delete the file created by user1 in user1/home by using user2. Briefly user2 removes user1's file but I am getting warning of there is no permission.
I will be really appreciated if enligted me.

rknichols 06-27-2013 12:37 PM

Removing (or creating) a file is an operation on the directory. You would need to give user2 write permission in the directory (and that might well be more permission than you wish to give).

Doc CPU 06-27-2013 12:41 PM

Hi there,

Quote:

Originally Posted by omegazafer (Post 4979680)
I created three users user1, user2, user3 in same computer.
User1 created a file in its home/general with permissions rwxrwxrwx(everyboy have all permissions). I changed the user from user1 to user2 in user1 area. I want to use delete the file created by user1 in user1/home by using user2. Briefly user2 removes user1's file but I am getting warning of there is no permission.

deleting a file involves a write access to the directory containing that file. So, to delete a file, you need to have write permission to the directory containing it.

Btw, I don't think your approach isn't a good one. Okay, it's no problem to share directories with other users. But being that generous about "everybody's" permission can be dangerous.
If two or more users work together on a project, I'd rather create a new group and put these users into it. Then, assign the shared directory to that group, and grant the group full access to the directory and the files in it.

[X] Doc CPU

litzel 06-27-2013 02:40 PM

Hi, have you tried to
Code:

sudo rm
the file you want to remove?

omegazafer 06-27-2013 03:38 PM

Thank you so much for your answers.
I overlooked the important point I had to give permission to holding directory.

litzel 06-28-2013 02:31 AM

You 're welcome!!


All times are GMT -5. The time now is 07:28 AM.