|Posted on:||06/01/22 19:26:23|
|Last edited:||06/01/22 19:26:23|
So, linux and other operating systems use files. You might have heard the expression “On Linux, everything is a file.”
And Linux uses lots of files. And if everyone had the same rights to all files, it’d be a mess. Unprivileged users would be able to edit critical system files.
So, in conclusion folks, applying personifying traits and giving ‘rights’ to computer programs to do whatever they want will create trouble! I’m talking to you, Github! No reason at all to change from master to main. Completely absurd.
detour ends here
ext4 filesystem has permission on files. I can get the permission
of a file using the
ls command with some fancy options:
# -l stands for long options $ ls -l articles/whatis-umask.md -rw-r--r-- 1 john cena 780 May 2 21:03 articles/whatis-umask.md
john is the owner of the file and
cena is the group owner
of the file. and the first characters are what matter:
that garbougle of characters is weird! let’s put some spaces!
-rw- r-- r--. Okay, looks better. These permissions are for the
user, group, and other, respectively. Yes,
john will have
cena will have
other will have
rw means read, write.
rwx means read, write, execute. Yes, execute as in execute
But cool thing is if it’s a directory the
x means you can create
files within the directory ! Try it out in a temp folder ! try making
a new dir, looking at file permissions of a folder with
ls -lad folder/
chmod -xing it. can you create files ? folders ? what happens
if you revert the
the umask command returns the inverse file mask used to create
new files within the current shell. Yes, INVERSE. not the ‘real’
mask you get with the
EVEN more confusingly, you can run the
command to get a set of friendly-looking
like in the
ls command which will now return the real file mask,
not the inverse. You can set the real permissions for your current
shell in the same way by just typing out the permissions you want.
umask -S u=rwx,g=rx,o=rx