LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How can my user delete a root owned file? (https://www.linuxquestions.org/questions/linux-general-1/how-can-my-user-delete-a-root-owned-file-4175422516/)

lupe 08-16-2012 06:51 PM

How can my user delete a root owned file?
 
I created the esm directory with my user `xcanm`.

$ ls -ld esm/
drwxr-xr-x 6 xcanm users 4096 Ago 17 00:35 esm/

$ cd esm/

Inside I have the a.dd file owned by root.root

$ ll
total 489504
-rw-r--r-- 1 root root 501211136 Ago 17 00:25 a.dd
-rw-r--r-- 1 root root 32768 Dez 31 1979 $RFS_LOG.LO$
drwxr-xr-x 3 root root 4096 Ago 17 00:31 VIDEO

Using my user, I'm able to delete the file, although with this question.
$ rm a.dd
(translated) rm: remove regular file «a.dd» write protected?y

$ ll
total 36
-rw-r--r-- 1 root root 32768 Dez 31 1979 $RFS_LOG.LO$
drwxr-xr-x 3 root root 4096 Ago 17 00:31 VIDEO


Maybe it's too late for me at night... Is it me or this should not happen?

evo2 08-16-2012 07:02 PM

Hi,

because you own the directory.

Evo2.

towheedm 08-16-2012 10:44 PM

It all has to do with understanding how permissions work under Linux. Here's two link to start you off with:
http://mywiki.wooledge.org/Permissions
http://www.grymoire.com/Unix/Permissions.html

Also, have a look this thread:
http://www.linuxquestions.org/questi...gs-4175414285/

devnull10 08-17-2012 05:31 PM

As above, you own the directory and the dir has rwx for the owner. Who owns the files inside (or their permissions) is irrelevant (unless you use the sticky bit on the directory).

sundialsvcs 08-21-2012 10:21 AM

Yes, you can remove a file that you can't open, because from Linux's point of view you're removing the directory-entry that points to the file (inode). The now-orphaned inode goes away because nothing points to it.


All times are GMT -5. The time now is 02:59 PM.