Meaning of chmod 1775
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
.
Related videos on Youtube
kesari
Updated on September 18, 2022Comments
-
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 tols -alF
and the name of the folder now appears in white text with a blue background.Please explain.
-
kesari almost 9 yearsThe extra
d
that comes at the first of each entry indicates that the entry is about a directory. Doeschmod
pick this up from the permissions or theinode
of the folder ? -
John almost 9 yearsIt 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 almost 9 yearsIt is written in the inode which holds the directory (parent).
-
ArthurDM about 3 yearsNot other than unnecessarily marking up
random words
as literals.