[LINUX] I tried to summarize the umask command

Introduction

There are various introductions of umask command and mask value on the net, I will post an article because I found it difficult to use logical sum, logical product, and bit inversion.

What is the umask command?

When creating a new file or directory Decide what kind of access rights (permissions) to mask.

You can ** mask ** for each ** user **. By the way, umask is an abbreviation for user mask.

What is a mask?

In the first place, what is a mask means "cover". The mask we wear also "covers" the mouth, doesn't it?

How umask and mask values work

Let's look at the relationship between the umask command and the mask value. Originally, when creating a new file or directory, all privileges (777) are granted. By subtracting the mask value there, the access right actually granted is determined.

. 777 ← Access right when creating a new file or new directory -) 022 ← umask command execution result (mask value)

. 755 ← umask -S execution result ... *

** When creating a file, the x right is deprived from the access right of * It will be 644 (rw-r--r--). ** **

Actual machine operation

qiita.PNG

reference

The thousands digit "0" that is output when the umaks command is executed represents a special access right.

Summary

If you want to change the access right when creating a new file or directory, use the umask command. X rights are deprived when creating a file, so if you want to execute it as a program file Grant X rights with the chmod command. ~~ I hope the distribution of masks will return to normal soon ... ~~

Recommended Posts

I tried to summarize the umask command
I tried to summarize the graphical modeling.
[Linux] I tried to summarize the command of resource confirmation system
I tried to summarize SparseMatrix
LeetCode I tried to summarize the simple ones
I tried to summarize the basic form of GPLVM
I tried to summarize the string operations of Python
I tried to move the ball
I tried to estimate the interval.
[First COTOHA API] I tried to summarize the old story
I tried to summarize the code often used in Pandas
I tried to summarize the commands often used in business
[Machine learning] I tried to summarize the theory of Adaboost
I tried to summarize how to use the EPEL repository again
I tried to summarize Python exception handling
[LPIC 101] I tried to summarize the command options that are easy to make a mistake
I tried to recognize the wake word
Python3 standard input I tried to summarize
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to summarize Ansible modules-Linux edition
I tried to summarize the commands used by beginner engineers today
I tried to summarize the frequently used implementation method of pytest-mock
I tried to debug.
I tried to paste
I tried to optimize while drying the laundry
I tried to save the data with discord
I tried to touch the API of ebay
I tried to correct the keystone of the image
Qiita Job I tried to analyze the job offer
I tried to implement the traveling salesman problem
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
I tried to summarize until I quit the bank and became an engineer
I tried to summarize the general flow up to service creation by self-education.
I tried to summarize various sentences using the automatic summarization API "summpy"
I tried to summarize the logical way of thinking about object orientation.
I tried to summarize the Linux commands used by beginner engineers today-Part 1-
I tried to control the network bandwidth and delay with the tc command
I tried to learn the sin function with chainer
I tried to summarize the relationship between probability distributions starting from the Bernoulli distribution
I tried to learn PredNet
I tried to summarize how to use matplotlib of python
I tried to detect the iris from the camera image
I tried to summarize the settings for various databases of Django (MySQL, PostgreSQL)
I tried to touch the CSV file with Python
I tried to predict the J-League match (data analysis)
I tried to organize SVM.
I tried to solve the soma cube with python
I tried to implement PCANet
I tried to summarize the operations that are likely to be used with numpy-stl
I tried to approximate the sin function using chainer
I tried the changefinder library!
I tried to summarize four neural network optimization methods
I tried to put pytest into the actual battle
[Python] I tried to graph the top 10 eyeshadow rankings
I tried to reintroduce Linux
I tried to visualize the spacha information of VTuber
I tried to introduce Pylint
I tried to summarize how to use pandas in python