Meaning of chmod 1775

9,742

Solution 1

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.

Solution 2

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.

Share:
9,742

Related videos on Youtube

kesari
Author by

kesari

Updated on September 18, 2022

Comments

  • kesari
    kesari over 1 year

    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.

  • kesari
    kesari almost 9 years
    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 ?
  • John
    John almost 9 years
    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.
  • Ned64
    Ned64 almost 9 years
    It is written in the inode which holds the directory (parent).
  • ArthurDM
    ArthurDM about 3 years
    Not other than unnecessarily marking up random words as literals.