LFCS Exam: Linux Umask Value for Default Access Permissions

Umask Value for Default Access Permissions

Question

SIMULATION -

Which umask value will result in the default access permissions of 600 (rw-------) for files and 700 (rwx------) for directories? (Specify only the numerical umask value.)

Explanations

0077, 077

In Linux, the umask command is used to set the default permissions of newly created files and directories. It works by subtracting the umask value from the maximum permissions allowed for the file or directory.

The maximum permissions for files are 666 (rw-rw-rw-) and for directories are 777 (rwxrwxrwx). To achieve the desired default permissions of 600 (rw-------) for files and 700 (rwx------) for directories, we need to subtract the appropriate value from the maximum permissions.

For files:

  • We want to remove all permissions for group and other users, so we need to subtract 0666 from the maximum permissions.
  • This results in a umask value of 0666, since 666 - 0666 = 600.

For directories:

  • We want to remove all permissions for group and other users, and remove write permission for the owner, so we need to subtract 0777 from the maximum permissions.
  • This results in a umask value of 0700, since 777 - 0700 = 700.

Therefore, the umask value that will result in the default access permissions of 600 (rw-------) for files and 700 (rwx------) for directories is 0666.