LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   A query regarding sticky bit (https://www.linuxquestions.org/questions/linux-software-2/a-query-regarding-sticky-bit-4175580942/)

techie_san778 05-29-2016 01:26 AM

A query regarding sticky bit
 
Hello Friends,

To add a stick bit to the permissions of a directory, we have to do
$chmod g+t Folder01.
I want to know what is the effect of using t with u and o, i.e. to say,
$chmod u+t Folder01 or $chmod o+t Folder01 ?
I saw that the commands run without any error. But i want to know if there is some other effect than simply protecting the user's files in the directory from deletion from the members of the "Group" and "Others" ?

Regards

Turbocapitalist 05-29-2016 03:35 AM

The +t should have no effect on u and g, but a +s should have an effect. The manual page for "chmod" has a little information about SetGID, SetUID, and the sticky bit. You can watch it with "stat"

Code:

mkdir Folder01

chmod u-s,g-s,o+t Folder01;
stat -c"%a" Folder01;

chmod u-s,g+s,o+t Folder01;
stat -c"%a" Folder01;

chmod u+s,g+s,o+t Folder01;
stat -c"%a" Folder01;

I'm not sure that there is any effect of setting the SetUID bit on a directory, but on a file, especially an executable, you don't want it. It would allow other users to run the file as the owner of the file.

The sticky bit o=t should just protect the files from deletion by others.


All times are GMT -5. The time now is 12:20 PM.