Discussion:
unlink permissions unclear
(too old to reply)
m***@yahoo.com
2006-01-11 00:50:57 UTC
Permalink
I cannot understand the following situation:
I am trying to understand permisions.

File AAA created in /usr/tmp by user test:

drwxrwxrwt 2 sys sys 10240 Jan 10 15:59 /usr/tmp
-rw-rw-r-- 1 test group 6 Jan 10 16:14 /usr/tmp/AAA

User test2 can not delete it, see below :
/u/test2$ rm /usr/tmp/AAA
rm: /usr/tmp/AAA not removed: Permission denied (error 13)

User test2 belong to the same group as test, see lines from passwd file
below :

test:x:262:50::/u/test:/bin/ksh
test2:x:264:50::/u/test2:/bin/ksh

test2 can write to the file, I thought test2 should be able to delete
it. Why is that?
the man chmod clearly says regarding directories with sticky bit set:

who can delete :
anyone with write permissions to both file and directory

Your clarifications are very welcome.
Jean-Pierre Radley
2006-01-11 01:15:30 UTC
Permalink
***@yahoo.com typed (on Tue, Jan 10, 2006 at 04:50:57PM -0800):
| I cannot understand the following situation:
| I am trying to understand permisions.
|
| File AAA created in /usr/tmp by user test:
|
| drwxrwxrwt 2 sys sys 10240 Jan 10 15:59 /usr/tmp
| -rw-rw-r-- 1 test group 6 Jan 10 16:14 /usr/tmp/AAA
|
| User test2 can not delete it, see below :
| /u/test2$ rm /usr/tmp/AAA
| rm: /usr/tmp/AAA not removed: Permission denied (error 13)
|
| User test2 belong to the same group as test, see lines from passwd file
| below :
|
| test:x:262:50::/u/test:/bin/ksh
| test2:x:264:50::/u/test2:/bin/ksh
|
| test2 can write to the file, I thought test2 should be able to delete
| it. Why is that?
| the man chmod clearly says regarding directories with sticky bit set:
|
| who can delete :
| anyone with write permissions to both file and directory

The chmod man page would appear to be wrong.

A directory with the sticky bit set means that only the file owner and
the superuser may remove files from that directory. Other users are
denied the right to remove files regardless of the directory permissions.
--
JP
==> http://www.frappr.com/cusm <==
Bela Lubkin
2006-01-14 21:26:27 UTC
Permalink
Post by Jean-Pierre Radley
| I am trying to understand permisions.
|
|
| drwxrwxrwt 2 sys sys 10240 Jan 10 15:59 /usr/tmp
| -rw-rw-r-- 1 test group 6 Jan 10 16:14 /usr/tmp/AAA
|
| /u/test2$ rm /usr/tmp/AAA
| rm: /usr/tmp/AAA not removed: Permission denied (error 13)
|
| User test2 belong to the same group as test, see lines from passwd file
|
| test:x:262:50::/u/test:/bin/ksh
| test2:x:264:50::/u/test2:/bin/ksh
|
| test2 can write to the file, I thought test2 should be able to delete
| it. Why is that?
|
| anyone with write permissions to both file and directory
The chmod man page would appear to be wrong.
A directory with the sticky bit set means that only the file owner and
the superuser may remove files from that directory. Other users are
denied the right to remove files regardless of the directory permissions.
Starting with OSR506 (or maybe 505?), this is actually under control of
a kernel parameter. The default setting is the same as the only
possible behavior in earlier releases: files in sticky directories can
only be deleted (or renamed) by their owner. If you set
`sec_sticky_group' to 1 in /etc/conf/pack.d/kernel/space.c,
group-writable files can then be deleted or renamed by members of that
group.

I'm pretty sure that turning this on puts the system in violation of the
XPG4.2 standards it's supposed to comply with. But that's up to the
administrator, and I don't think it causes any practical problems with
the OS utilities.
Post by Jean-Pierre Radley
Bela<
Bill Campbell
2006-01-11 01:27:33 UTC
Permalink
Post by m***@yahoo.com
I am trying to understand permisions.
drwxrwxrwt 2 sys sys 10240 Jan 10 15:59 /usr/tmp
-rw-rw-r-- 1 test group 6 Jan 10 16:14 /usr/tmp/AAA
/u/test2$ rm /usr/tmp/AAA
rm: /usr/tmp/AAA not removed: Permission denied (error 13)
User test2 belong to the same group as test, see lines from passwd file
The key is that the /usr/tmp directory has the ``sticky'' bit set (the
``t'' at the end of drwxrwxrwxt in the long listing). When set on a
directory, it prohibits any user but the owner (and root) to delete the
file or directory.

Bill
--
INTERNET: ***@Celestial.COM Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676

``Democracy Is Mob Rule with Income Taxes''
Loading...