Created a folder "Sample_dir" and analysed its permissions.

$ mkdir Sample_dir
$ ll Sample_dir/
total 36
drwxrwxr-x  2 user user  4096 Jul  1 19:26 ./
drwx------ 71 user user 28672 Jul  1 19:26 ../

Looking at the first entry, I thought the argument that had to me given to chmod to achieve these permissions should be 1775.

$ chmod 1775 Sample_dir/
$ ll Sample_dir/
total 36
drwxrwxr-t  2 user user  4096 Jul  1 19:26 ./
drwx------ 71 user user 28672 Jul  1 19:26 ../

But, the ls output has changed.

ll has been aliased to ls -alF and the name of the folder now appears in white text with a blue background.

Please explain.


The permissions you got were the permissions you asked for. The 't' comes from the '1' in the '1775' permissions string you specified, and sets what is called the "sticky bit". This tells the system that files in that directory can only be renamed or removed by the file's owner, the directory's owner, or the root user. The get the permissions you wanted initially, you would have needed to use "755" or "0755" as the permissions argument to chmod.

  • The extra d that comes at the first of each entry indicates that the entry is about a directory. Does chmod pick this up from the permissions or the inode of the folder ? – kesari Jul 1 '15 at 14:21
  • 2
    It comes from the type of entry it is. - is a regular file, d is a directory, l is a symlink, c is a character device, b is a block device. That first character has nothing to do with permissions. – John Jul 1 '15 at 14:24
  • So does it come from the inode ? – kesari Jul 1 '15 at 14:26
  • It is written in the inode which holds the directory (parent). – Ned64 Jul 1 '15 at 14:29

The t comes from the 1 in the '1775' permissions that called sticky bit. the sticky bit is used to protect files from being deleted or renamed by those who dont own the files so the files can be deleted only by their owners, the directory owner, or root. it can be set, in directories that many users should have write access, such as /tmp.

  • Is there something in this answer that was not already in the previous answer? – RalfFriedl Aug 26 '18 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.