1832433 Members
3174 Online
110042 Solutions
New Discussion

Sticky Bit

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

Sticky Bit

I understand how to set the 'group' stickt bit to force all files created under this directory to have the same ownership as the parent droup name. (chmod g+s 'filename')

My question is, is there an option to use the sticky bit for the owner instead of the group?
I want all files created under a certain directory to inherit the ownership of the dir.


10x
RPM
UNIX IS GOOD
3 REPLIES 3
Mark Grant
Honored Contributor

Re: Sticky Bit

setting the sticky bit for the owner has a different meaning. It says only the owner of the file within the directory can delete/change mode of the file.

I don't know of a way that you can force the owner to be a particular user underneath a directory and feel sure there is a security risk in there somewhere.
Never preceed any demonstration with anything more predictive than "watch this"
RAC_1
Honored Contributor

Re: Sticky Bit

setgid or setuid is not for that. Instead, you can set umask so that files created get the perms you want.

umask of 022 will gives perms as follows.

umask 022
touch aa
ll aa
-rw-r--r--

Anil
There is no substitute to HARDWORK
Geoff Wild
Honored Contributor
Solution

Re: Sticky Bit

Here is a short description:

4xxx SETUID
2xxx SETGID
1xxx STICKY BIT

They add-up, so 6xxx is SETUID and SETGID

A filesystem with a STICKY BIT set, would prevent a user to delete a file for which he doesn't have write permission.

Sticky bit has two meanings

Sticky bit on executables -> As the names implies it is sticky. It will keep the process's text in memory so that when the next time it is run, it's text doesn't have to be read from the disk again.

Sticky bit on directories -> files in them can only be deleted by the owner even if the directory carries universal write permissions.

man chmod for more info.


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.