umask 0022 and 22

KUPI

New Member
Joined
Aug 30, 2019
Messages
27
Reaction score
5
Credits
192
Hello everyone,

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

Does both are same?
 


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


Top