Junior — Middle
What permissions are assigned to a file upon creation?.
sobes.tech AI
Answer from AI
When creating a file in Unix-like systems, access rights are assigned based on the current file creation mask (umask). By default, if the umask is not considered, the file is assigned permissions 666 (rw-rw-rw-) — read and write for owner, group, and others.
However, the actual permissions are calculated as 666 minus the umask. For example, if the umask is 022, the resulting permissions will be 644 (rw-r--r--).
For directories, the base permissions are usually 777 (rwxrwxrwx), also modified by the umask.
Thus, the permissions when creating a file depend on the system's umask settings, which can be viewed with the command:
umask
And an example of creating a file with default permissions:
touch newfile.txt
ls -l newfile.txt