1, why should have sticky bit?
Linux has a directory to hold temporary files,/tmp (similar to the temp directory in Windows), each user generated temporary files are stored in this directory, that is, each user should have write permission to the/tmp directory (otherwise cannot copy the makefile), which creates a problem, for example, A classmate in the/tmp directory created a file, B classmates look at the uncomfortable can be deleted, how to control?
In fact, this situation will never happen because the/TMP directory has a special permission tag:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/83/18/wKiom1dql9ORBviSAAAsAzxLpmM643.png "title=" screen Shot 2016-06-22 at 21.50.35.png "alt=" Wkiom1dql9orbvisaaasazxlpmm643.png "/>
See that rwx permission last "T" no, that magical "T" is sticky bit t (some of the information is also known as sticky bit), is the third of Linux special permissions (the other two is setuid and setgid), defined as: The permissions of 777 of the directory set sticky bit t, With Write permissions each user can create files in the directory, except that each user can only delete files that they are the owner, that is, they can only delete files that they have created.
2, how to set the sticky bit?
chmod +t/-t Directory Name
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/83/18/wKiom1dqmWDTmn1yAAAP3deApO0609.png "title=" 2016-06-22 21-56-23 screen. png "alt=" Wkiom1dqmwdtmn1yaaap3deapo0609.png "/>
This article from "Momo is spicy moe" blog, please be sure to keep this source http://momo462.blog.51cto.com/10138434/1791927
Sticky bit permissions under Linux