File/directory permission question
Ed Wilts, RHCE
ewilts at ewilts.org
Fri Dec 3 04:30:17 UTC 2004
On 12/02/2004 10:13 PM, Peter Blajev wrote:
> I created the following directory structure and file aaaaa:
>
> [peter at sdpeter asdf]$ ls -al
> total 8
> drwxrwxrwx 2 peter peter 4096 Dec 2 20:02 .
> drwxrwxrwx 8 peter peter 4096 Dec 2 20:00 ..
> -rw-rw-r-- 1 peter peter 0 Dec 2 20:02 aaaaa
>
> Then I decided to chown the file and got "Operation not permitted"
>
> [peter at sdpeter asdf]$ chown gregory aaaaa
> chown: changing ownership of `aaaaa': Operation not permitted
>
> What is going on here?
> It's my file. Shouldn't I be able to do whatever I want with it?
Nope. Imagine if you had disk quotas enabled. Would you like it if
another user decided to create a 2GB file and charged you for the disk
space? That's what you're trying to do in this case - charge gregory
for the file when he might not even have access (he might not have
access to the directory the file is in). That wouldn't be fair.
> Another example:
>
> 4 drwxrwxrwx 2 peter users 4096 Dec 2 20:02 .
> 4 drwxrwxrwx 8 peter users 4096 Dec 2 20:00 ..
> 0 -rw-r--r-- 1 gregory users 0 Dec 2 20:02 aaaaa
>
> Why peter can not chmod file aaaaa?
Because peter only has read access to the file. gregory owns it and has
read and write access. If peter could chmod it, he could grant other
users (and himself!) write access to the file when you've only allowed
him read access.
.../Ed
--
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts at ewilts.org
Member #1, Red Hat Community Ambassador Program
More information about the redhat-list
mailing list