Introduction
In this challenge, you will learn how to manage default file permissions in a Linux system. Understanding and controlling default permissions is a crucial aspect of system administration, as it helps ensure the security and accessibility of newly created files and directories. You will use the umask command to set the default permission mask and observe its effect.
Manage Default Permissions with umask
Your task is to set a specific umask for your shell session and then create a new file and directory to verify that the default permissions are applied correctly.
Tasks
- Set the
umaskvalue to0022for your current shell session. - In the
~/projectdirectory, create an empty file namedtest_file. - In the
~/projectdirectory, create a new directory namedtest_dir.
Requirements
- All operations must be performed in the
~/projectdirectory. - Use the
umaskcommand to set the permission mask. - Use the
touchcommand to create the file. - Use the
mkdircommand to create the directory.
Example
After correctly setting the umask and creating the file and directory, checking their permissions with ls -l should produce an output similar to this:
$ ls -l ~/project
total 0
drwxr-xr-x 2 labex labex 6 Aug 19 07:43 test_dir
-rw-r--r-- 1 labex labex 0 Aug 19 07:43 test_file
Summary
In this challenge, you have learned how to manage default permissions for new files and directories in a Linux system. You used the umask command to set a permission mask and observed how it affects the permissions of a newly created file and directory. This skill is fundamental for system administrators to ensure that files are created with appropriate security settings by default, protecting data and maintaining a well-structured system.



