umask 0022 and 22

KUPI

New Member
Hello everyone,

what is the difference between the umask value 0022 and 22.

Does both are same?
 


CptCharis

Well-Known Member
Umask command controls the default permissions given to a file when it is created.
It is uses octal notation to express a mast of bits to be removed from a file's mode attributes.
if you run command "umask" in your terminal it will return
"0002" which is the octal representation of your mask.

This means that if you create a file this will have for example test.txt and run ls -la command you will see
-rw-rw-r-- user user X XXX-XX-XX XX:XX test.txt
try it.

Now remove your file test.txt and set your umask by yourself.
rm test.txt
umask 0000
touch test.txt
ls -l test.txt If everything went well you should see this
-rw-rw-rw- user user X XXX-XX-XX XX:XX test.txt
Now your file is writable by others too.

On the same way working umask 0022.
Try it and you will see.
 



Members online


Latest posts


Top