Operating System - HP-UX
1844385 Members
3390 Online
110232 Solutions
New Discussion

Unix file/directory permissions

 
Carey Goad
Occasional Advisor

Unix file/directory permissions

I would like to create a directory that allows any user to add, change, and delete files from subdiretories under the directory. I do not want to use umask if possible - is there a way to do this with the sticky bit? I would prefer directories and files to be created with rwxrwxrwx (everyone having full access).

Thanks
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: Unix file/directory permissions

Carey:

Take a look at document #A4770206 ( Prevent removal of files by non-owner; set sticky bit on dir ). I think this defines and meets your objectives.

...JRF...
Shannon Petry
Honored Contributor

Re: Unix file/directory permissions

What you need to do is set permissions to 1777 on the directory. I.e.
> mkdir /users_stuff
> chmod 1777 /users_stuff
> ll /users_stuff
drwxrwxrwt 2 root other 117 Sep 14 14:22 ./users_stuff

This is the sticky bit which allows users to create and delete files in this directory, but other users can not delete their files. In all UNICES other than HP-UX, this is the default permissions for /tmp, /var/tmp, and /usr/tmp. TAKE NOTES HP!
Microsoft. When do you want a virus today?
federico_3
Honored Contributor

Re: Unix file/directory permissions

A directory with sticky bit set means that only the file owner and the superuser may remove files from that directory. Other users don't have the rigth do do this regardless the dir. permissions.
If a directory is writable and has the sticky bit set, files within that dir. can be removed or renamed only if one or more of the following is true:
The user owns the file
the user owns the dir
the file is writable by the user
the user is root

About the creation of files and subdirectories there are not problems!

I hope this helps

Federico