1833914 Members
2173 Online
110063 Solutions
New Discussion

Sticky Bit

 
SOLVED
Go to solution
Victor Chow
New Member

Sticky Bit

We are using HP-UX 11x. I created a test directory under my home drive. I used the chmod 1777 command and set the test directory so the any users can share files but cannot delete files that does not belong to them. All users belong the the group=users. I created a file in the test directory and login as another user. The user that was login can still delete the file created by me. Can someone please provide me with the instructions on how I can setup a shared directory in which users can share but cannot delete files created by other users
4 REPLIES 4
Rodney Hills
Honored Contributor

Re: Sticky Bit

As far as I can tell you did everything right

I did same as you

login user1
mkdir /tmp/test
chmod 1777 /tmp/test
touch /tmp/test/sample
exit

login user2
mv /tmp/test/sample /tmp/test/newname
mv: cannot move `sample' to `newname': Not owner

Check that the second user you logged in as does not have the same UID number as the first user.

-- Rod Hills
There be dragons...
Scott Van Kalken
Esteemed Contributor

Re: Sticky Bit

check the permissions on the file in the directory.

I've done this before:

[foo@melhpux1] /home/foo-> cd /tmp/test
[foo@melhpux1] /tmp/test-> ll
total 0
-rw-rw---- 1 sup2000 group 0 Jul 30 09:24 aaa
[foo@melhpux1] /tmp/test-> more aaa
[foo@melhpux1] /tmp/test-> echo "hi" > aaa
[foo@melhpux1] /tmp/test-> more aaa
hi
[foo@melhpux1] /tmp/test-> rm aaa
rm: aaa not removed. Permission denied
[foo@melhpux1] /tmp/test-> cd ..
[foo@melhpux1] /tmp-> ll | grep test
drwxr-xr-t 2 root group 96 Jul 30 09:24 test
[foo@melhpux1] /tmp->
Pierce Byrne_1
Frequent Advisor
Solution

Re: Sticky Bit

victor,
i think the problem is with your umask. if this is set so that files are created with group write permissions (eg 02) then the sticky bit will be ignored and any user in the group can remove the file. Or if the file has global write any user regardless of group can remove it.
The sticky bit is only useful for files where user has full write to the directory but read only on files in it. without the sticky bit set the user can override the individual file permissions and remove these. But if sticky bit is set & files are read only then the file permissions cannot be overridden.

Suggest you set umask 022
doug hosking
Esteemed Contributor

Re: Sticky Bit

Take a look at kernel patch PHKL_24216.
Depending on which 'x' in '11x' that may be
relevant.