Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]deleting root owned files as normal user
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
michael_
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2007
Posts: 76
Location: Trier

PostPosted: Mon Sep 06, 2010 1:29 pm    Post subject: [solved]deleting root owned files as normal user Reply with quote

hi there,

i discoverd the following behavior on my system :

create a file as root :
Code:

plauze michael # whoami
root
plauze michael # id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video),1003(vmware)
plauze michael # pwd
/home/michael
plauze michael # touch test
plauze michael # chmod 600 test
plauze michael # ls -l test
-rw------- 1 root root 0  6. Sep 15:20 test
plauze michael #


as you can see, i created 'test' under /home/michael, which is my users home directory
after that i did as user michael

Code:

michael@plauze ~ $ whoami
michael
michael@plauze ~ $ id
uid=1000(michael) gid=1000(michael) groups=1000(michael),10(wheel),18(audio),19(cdrom),27(video),35(games),80(cdrw),85(usb),100(users),1002(plugdev),1003(vmware),1004(wg),1006(scanner),1009(vboxusers),1012(svnusers),1016(firma)
michael@plauze ~ $ ls -l test
-rw------- 1 root root 0  6. Sep 15:20 test
michael@plauze ~ $ rm test
rm: remove write-protected regular empty file `test'? y
michael@plauze ~ $ ls -l test
ls: cannot access test: No such file or directory
michael@plauze ~ $


and the file test is gone.

is that a normal behavoir ? and if so, why and how can i stop this ?

if you need more info about my system, plz let me know.

thx for any help,
michael


Last edited by michael_ on Mon Sep 06, 2010 3:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
Goverp
l33t
l33t


Joined: 07 Mar 2007
Posts: 906

PostPosted: Mon Sep 06, 2010 1:50 pm    Post subject: Delete updates the DIRECTORY not the FILE. Reply with quote

That's normal behaviour. The file mode controls whether you can read, write or execute the file.
The file's name is an entry in the directory, so deleting the file requires write permission on the directory
The file's mode is irrelevant. The same is true for creating the file.

root can create a directory and give michael write access to that directory to create,
rename and delete files in it, and the files will be owned by michael. not root
(assuming normal umask).

FWIW it took me some time to understand this, coming from a mainframe background.
There you had read, write, create and delete permissions at the file (or more accurately file template) level.
I think Windows works in a similar way.
_________________
Greybeard
Back to top
View user's profile Send private message
michael_
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2007
Posts: 76
Location: Trier

PostPosted: Mon Sep 06, 2010 3:14 pm    Post subject: Reply with quote

thank you very much for the quick reply.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum