LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-16-2012, 06:51 PM   #1
lupe
Member
 
Registered: Dec 2008
Distribution: Slackware, FreeBSD, NetBSD, Haiku
Posts: 60

Rep: Reputation: 2
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?
 
Old 08-16-2012, 07:02 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

because you own the directory.

Evo2.
 
Old 08-16-2012, 10:44 PM   #3
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Stretch
Posts: 612

Rep: Reputation: 125Reputation: 125
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/

Last edited by towheedm; 08-16-2012 at 10:54 PM.
 
Old 08-17-2012, 05:31 PM   #4
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
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).
 
1 members found this post helpful.
Old 08-21-2012, 10:21 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,632
Blog Entries: 4

Rep: Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to restrict root user to delete a file or directories aggrishabh Linux - Newbie 12 01-22-2011 08:50 AM
root-owned file is able to be deleted with my non-root account win32sux Linux - Security 3 11-18-2008 02:00 AM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
user access to files owned by root jonfa Linux - General 2 07-09-2007 11:58 AM
Make a file owned by root owned by a user sharpie Linux - Newbie 2 02-26-2004 01:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration