LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2006, 12:47 PM   #1
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
How exactly does Linux file permission inheritance work


I'm familar with file permissions under Linux. However, one thing I'm not sure of is how come I'm able to delete a file when I shouldn't have the right to. I have it set that the parent folder has rights to read/write/execute but the file only has read/execute permission. So why am I able to delete the file? I'm using Debian Sarge and here's the parent folder's permission:

drwxrwxr-x 2 root users 48 2006-04-13 11:35 test

The file's permissions are as so:

-rw-r--r-- 1 root root 0 2006-04-13 12:45 testfile

Now as geneanthony which belongs to the user's group I can delete testfile. However, the permissions on the file says I can't, how come I can? What's the purpose of a file ACL if the parent folder always overrides it?
 
Old 04-13-2006, 01:22 PM   #2
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
Because if a folder/directory has write permission then it overrules the file permissions. Usually you would give the directory read and execute permissions enabling someone to enter the directory, then they can only do what they have permission to do to the file.

I'd suggest you read up a bit more on permissions and create a couple of accounts to play around with to test things out.

Also investigate the 'sticky bit' permissions.

Last edited by Dudydoo; 04-13-2006 at 02:01 PM.
 
Old 04-13-2006, 02:09 PM   #3
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

I am playing around with a few accounts including one circumstance where I changed the permission to give write permission on the file, but none on the folder and I couldn't delete it anymore, so if the folder doesn't have write permission I can't write to a folder no matter what. So basically the only bit that seems to work on files is the executable bit correct? I mean if I don't have read/execute permission on the folder I can't go into the directory anyway and I'll have read permission since it would be inherited as well. I'm not opposed to this system, I'm just trying to understand it.
 
Old 04-13-2006, 02:42 PM   #4
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Rep: Reputation: 31
Quote:
I am playing around with a few accounts including one circumstance where I changed the permission to give write permission on the file, but none on the folder and I couldn't delete it anymore, so if the folder doesn't have write permission I can't write to a folder no matter what.
You can write to the file. Open it in $EDITOR, make changes and save it. That should be no problem. You can't change the contents of the directory though, because you have no writing permission there.
 
Old 04-13-2006, 06:14 PM   #5
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

I see what you mean. OK, this makes sense now. Thank you for your help.
 
Old 04-14-2006, 11:20 AM   #6
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
File permissions:

r = read the contents of the file
w = modify the file
x = run the file as an executable

Directory permissions:

r = list the contents of the directory, but not 'ls' into it
w = delete or add a file in the directory
x = move into the directory
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible to set a fixed permission inheritance for child objects? Berkut83 Red Hat 2 01-20-2006 11:15 AM
file inheritance tulip4heaven Linux - Networking 1 02-24-2005 03:30 AM
File permission inheritance HowTo ? Satriani Linux - Security 4 11-26-2004 06:13 AM
Linux File permission & the sticky bit hq4ever Linux - Newbie 8 07-02-2004 04:46 PM
umask...inheritance of file attributes problem iam3 Linux - General 0 11-11-2001 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:19 PM.

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