https://drive.google.com/file/d/1bMW0FFozaNIqTOMCbp_5SV-v71U7t3Gx/view?usp=sharing
umask (Default Permissions)umask defines the default permissions for newly created files and directories by masking (subtracting) permissions from the maximum.
666 (rw-rw-rw-)777 (rwxrwxrwx)umask Values| umask | File Permissions | Dir Permissions | Use Case |
|---|---|---|---|
0022 |
644 (rw-r--r--) |
755 (rwxr-xr-x) |
Default for most systems |
0077 |
600 (rw-------) |
700 (rwx------) |
Private files (no group/others access) |
umask -S # Show symbolic form: u=rwx,g=rx,o=rx
umask 0077 # Set restrictive default
umask 0022 # Set standard default
Check current umask:
umask -S
Create a file and check permissions:
umask 0077
touch private.txt
ls -l private.txt # Should be -rw-------
umask is per-session. Set it in ~/.bashrc for persistence.umask 0000—it gives full access to everyone!+t)