permision bits question

Hi ,

can someone tell me what is the meaning of the T bit in the permission

i mean


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It's the sticky bit, usually set for /tmp - from chmd(2) man page:

If a directory is writable and has S_ISVTX (the sticky bit) set, files within that directory can be removed or renamed only if one or more of the following is true (see unlink(2) and rename(2) ):
the user owns the file
the user owns the directory
the file is writable by the user
the user is a privileged user

It is to prevent users deleting other users files in a shared / scratch directory like /tmp
Hi victorbx,

liddler is right ... t means sticky bit

When the sticky bit (t) is turned on for a directory users can have read and/or write permissions for that directory, but they can only remove or rename files that they own. The sticky bit on a file tells the operating system that the file will be executed frequently. Files like this are kept in swap space even when they aren't being executed. Although this takes up swap space it greatly reduces the time it takes to execute the program. Programs such as vi have the sticky bit turned on by default.

Once upon a time, Unix didn't have paged virtual memory.  Setting the sticky
bit on an executable caused the kernel to keep the text image in core (make
it `sticky') after a process using it had closed.  This was typically done
on often-used binaries, such as /bin/sh or /bin/vi.

Later on, people noticed a security hole on /tmp: since it has world-write
permission (so that anyone can create temporary files there) it's possible
to delete other people's files.  The solution was to overload the meaning of
the sticky bit for directories: if a directory is sticky, then you can only
delete files in that directory if you own them (or if you're root).

Eventually, when paged virtual memory became standard, kernels ignored the
sticky bit on files, but the name remained for the use of the bit on


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

This means only the owner of a file can remove or rename it.
Very handy in shared directories like /tmp.

The chmod man page does not indicate the affect of the "t"/leading
1/stick bit attribute on directories.  I'm told that this prevents
unprivileged users from deleting files that they /do/ have write
access to.  I haven't tested this, but I imagine that it is common

Just to clear up the confusion here.  The 't' bit has an original
meaning for executable programs.  [Keep a copy of the text (which
means code in unix speak) on the swap disk so that it loads faster on
subsequent runs because it can stream the preloaded image from the
swap disk instead of loading from the filesystem disk.  For various
reasons I think this is better to be avoided with modern operating
systems.  It was implemented while UNIX was still extremely primitive.
Much time has passed since then.]  But this did not have a meaning
when applied to directories.  Therefore when a need to create
functionality regarding directories arose they overloaded the 't'ext
bit and gave it a unique meaning when applied to a directory.

On a directory the 't' bit means that if you do not own the file you
cannot delete it.  This is needed on shared, writable directories like
/tmp to prevent one user from deleting another user's files.  Many
programs, like vi as one example, use /tmp for temporary files.
Without the 't' bit anyone could wipe out the entire /tmp directory
and break random programs.  Some of those programs would include
system processes as well.  Therefore shared writable directories
usually require the 't' bit for protection.  It allows you to create
files but prevents you from deleting files created by other users.

Hope this helps
victorbxAuthor Commented:
Thank you for the greate answers

from all of you


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.