どのumask値を使用すると、ファイルのデフォルトのアクセス許可は600(rw -------)、ディレクトリの場合は700(rwx ------)になりますか?
(umask数値のみを指定します。)
正解:
0077, 077
Explanation
The umask value that will result in the default access permissions of 600 (rw-------) for files and 700 (rwx------) for directories is 077. This is because the umask value is an octal number that represents the permissions that are not given to the files or directories. To calculate the umask value, we need to subtract the desired permissions from the maximum permissions, which are 666 for files and 777 for directories. For example, if we want the files to have the permissions 600 (rw-------), which means read and write for the owner and no permissions for the group and others, we need to subtract 600 from 666, which gives us 066.
Similarly, if we want the directories to have the permissions 700 (rwx------), which means read, write, and execute for the owner and no permissions for the group and others, we need to subtract 700 from 777, which gives us 077.The umask value is the minimum of these two values, which is 077. The first digit of the umask value is for the special permissions, such as setuid, setgid, and sticky bit, and it is usually set to 0. Therefore, the final umask value is 077. For more information on how to use the umask command, you can refer to the following articles:
* What Is umask in Linux, and How Do You Use It? - How-To Geek
* Umask command in Linux with examples - GeeksforGeeks
* What is UMASK and how to set UMASK in Linux/Unix?
* How to Set and Update the Default Umask Value - phoenixNAP