LPI E C1 - umask test

LPIC-1 (Linux Administrator)

104.5 Manage file permissions and ownership

Candidates should be able to control file access through the proper use of permissions and ownership.

Some questions taken from this blog:
https://www.certificationmethods.com/2023/05/lpi-e-umask-control.html


 

Practice Test Questions

1. Which of the following statements best describes the purpose of the "umask" command in Linux?
a) It displays the current system time.
b) It sets the permissions for a file or directory when it is created.
c) It changes the ownership of a file or directory.
d) It lists all the files and directories in a given directory.
/* --------------------- */

--------------------------

Answer 1 Below: 

--------------------------

/* --------------------- */

Explanation:
It sets the permissions for a file or directory when it is created. The umask command allows you to determine the default permissions that are subtracted from the maximum allowable default permissions when a file or directory is created.
 
Choice a) is incorrect because the umask command is not used to display the system time.
Choice c) is incorrect because the umask command does not change the ownership of a file or directory.
Choice d) is incorrect because the umask command does not list files and directories; it sets permissions.
 
1. The correct answer is b)

2. What are the default permissions for directories in Linux?
a) rwxrwxrwx
b) rw-rw-rw-
c) rwxr-xr-x
d) rwxrwx---
/* --------------------- */

--------------------------

Answer 2 Below: 

--------------------------

/* --------------------- */

Explanation:
The default permissions for directories in Linux are rwxrwxrwx, which means read, write, and execute permissions are granted to the owner, group, and others.


Choice b) is incorrect because those permissions correspond to files, not directories.
Choice c) is incorrect because it does not grant write permissions to the group and others.
Choice d) is incorrect because it does not grant read permissions to the group and others.
 
2. The correct answer is a) rwxrwxrwx.

3. Which of the following umask values would result in new files having permissions of rw-r----- by default?
a) 007
b) 022
c) 027
d) 077
/* --------------------- */

--------------------------

Answer 3 Below: 

--------------------------

/* --------------------- */

Explanation:
The umask value of 027 indicates that the permissions to subtract from the default permissions are group write (w) and others read and execute (r-x). Subtracting these permissions from the maximum default permissions for files (666) results in rw-r-----.

Choice a) is incorrect because it would result in permissions of rw-rw----.
Choice b) is incorrect because it would result in permissions of rw-r--r--.
Choice d) is incorrect because it would result in permissions of rw-------.
 
3. The correct answer is c) 027. 

4. What is the significance of the first digit in the output of the "umask" command?
a) It indicates the umask is given as an octal number.
b) It indicates the permissions to subtract from the default user owner's permissions.
c) It indicates the permissions to subtract from the default group owner's permissions.
d) It indicates the permissions to subtract from the default other's permissions.
/* --------------------- */

--------------------------

Answer 4 Below: 

--------------------------

/* --------------------- */

Explanation:
The first digit in the output of the umask command specifies that the umask value is represented in octal format.


Choice b) is incorrect because it describes the significance of the second digit.
Choice c) is incorrect because it describes the significance of the third digit.
Choice d) is incorrect because it describes the significance of the last digit.
 
4. The correct answer is a) It indicates the umask is given as an octal number.

5. Which user is likely to have a more restrictive umask than normal user accounts?
a) Administrator
b) Guest
c) Root
d) Standard User
/* --------------------- */

--------------------------

Answer 5 Below: 

--------------------------

/* --------------------- */

Explanation:
The root user typically has a more restrictive umask than normal user accounts. The umask value determines the default permissions subtracted from the maximum allowable default permissions, and the root user often has a umask of 0022, which is more restrictive.

Choice a) is incorrect because it is a generic term and does not specify a user role.
Choice b) is incorrect because the guest user is typically less restricted in terms of permissions.
Choice d) is incorrect because it does not specify a user role and can refer to different user accounts.
 
5. The correct answer is c) Root. 

6. What permissions would a file have if the umask is set to 0025?
a) rw-r--r-x
b) rwxr-xr--
c) rw-rw-r-x
d) rwxr-xr-x
/* --------------------- */

--------------------------

Answer 6 Below: 

--------------------------

/* --------------------- */

Explanation:
With a umask of 0025, the permissions subtracted from the default permissions for files (666) are group write (w) and others write and execute (r-x). This results in rw-r--r-x.

Choice b) is incorrect because it includes group execute permissions, which are not subtracted with the given umask.
Choice c) is incorrect because it includes group write permissions, which are not subtracted with the given umask.
Choice d) is incorrect because it includes group write and execute permissions, which are not subtracted with the given umask.
 
6. The correct answer is a) rw-r--r-x.

7. Which command should be used to permanently change a user's umask?
a) chmod
b) chown
c) umask
d) touch
/* --------------------- */

--------------------------

Answer 7 Below: 

--------------------------

/* --------------------- */

Explanation:
To permanently change a user's umask, you need to modify the .bashrc file located in that user's home directory. The umask command is used to set the umask value.


Choice a) is incorrect because chmod is used to change file permissions, not the umask.
Choice b) is incorrect because chown is used to change the ownership of a file or directory, not the umask.
Choice d) is incorrect because touch is used to create an empty file, not change the umask.
 
7. The correct answer is c) umask. 

8. Which command displays the current umask value?
a) ls
b) pwd
c) umask
d) chmod
/* --------------------- */

--------------------------

Answer 8 Below: 

--------------------------

/* --------------------- */

Explanation:
The umask command is used to display the current umask value in Linux.

Choice a) is incorrect because ls is used to list files and directories.
Choice b) is incorrect because pwd is used to print the current working directory.
Choice d) is incorrect because chmod is used to change file permissions, not display the umask value.
 
8. The correct answer is c) umask.

9. What permissions would a directory have if the umask is set to 0312?
a) rwxrwxr--
b) rwxr-xr-x
c) rwxrwxr-x
d) rwxr-x---
/* --------------------- */

--------------------------

Answer 9 Below: 

--------------------------

/* --------------------- */

Explanation:
With a umask of 0312, the permissions subtracted from the default permissions for directories (777) are user write (w) and others read and execute (r-x). This results in rwxr-xr-x.

Choice a) is incorrect because it includes group write permissions, which are not subtracted with the given umask.
Choice c) is incorrect because it includes group write permissions, which are not subtracted with the given umask.
Choice d) is incorrect because it does not include group execute permissions, which are subtracted with the given umask.
 
9. The correct answer is b) rwxr-xr-x.
 
10. Which command creates a new directory with specific permissions?
a) mkdir
b) touch
c) chmod
d) umask
/* --------------------- */

--------------------------

Answer 10 Below: 

--------------------------

/* --------------------- */

Explanation:
The mkdir command is used to create a new directory in Linux. By default, the permissions of the newly created directory will be determined by the umask value.

Choice b) is incorrect because touch is used to create a new file, not a directory.
Choice c) is incorrect because chmod is used to change permissions on an existing file or directory, not create a new one.
Choice d) is incorrect because umask is used to set the default permissions, not directly create directories.
 
10. The correct answer is a) mkdir.

Following Practice Exam Questions - Based Interstellar Voyage:

Read Here: https://www.certificationmethods.com/2023/05/lpi-e-umask-control.html

11. When creating a secure SFTP drop box, which combination of commands correctly sets the appropriate permissions and umask value?

a)
$ umask 022
$ mkdir -m 770 sftp_dropbox

b)
$ umask 007
$ mkdir -m 1770 sftp_dropbox

c)
$ umask 002
$ mkdir -m 750 sftp_dropbox
d)
$ umask 027
$ mkdir -m 2770 sftp_dropbox
/* --------------------- */

--------------------------

Answer 11 Below: 

--------------------------

/* --------------------- */

Explanation:
In order to create a secure SFTP drop box, the correct combination of commands is to set the umask value to 007 and create the directory with permissions of 1770. This ensures that the files uploaded to the "sftp_dropbox" directory have read and write access for the file owner and group, while denying access to others. The "s" in the group permissions enables the setgid attribute, which ensures that new files inherit the group ownership.


Option a) is incorrect because it sets a less secure umask value of 022, allowing more permissive group and others access.
Option c
) is incorrect because it also sets less restrictive permissions for the group and others.
Option d) is incorrect because it sets a more restrictive umask value of 027, which would result in denying write access to the group.
 
11. Answer: b)

12. Which set of commands enforces strict file permissions for a secure database?

a)
$ umask 022
$ touch secure_db.sql
$ chmod 644 secure_db.sql
b)
$ umask 027
$ touch secure_db.sql
$ chmod 600 secure_db.sql
c)
$ umask 002
$ touch secure_db.sql
$ chmod 777 secure_db.sql
d)
$ umask 007
$ touch secure_db.sql
$ chmod 400 secure_db.sql
/* --------------------- */

--------------------------

Answer 12 Below: 

--------------------------

/* --------------------- */

Explanation:
To enforce strict file permissions for a secure database, the correct set of commands is to set the umask value to 027, create the file, and then set its permissions to 600. This ensures that the "secure_db.sql" file has read and write access only for the file owner, while denying access to the group and others.


Option a) is incorrect because it sets more permissive permissions, allowing read access to the group and others.
Option c
) is incorrect because it sets excessively permissive permissions for the file.
Option d) is incorrect because it sets read-only permissions for the file owner, which may not be sufficient for a secure database.
 
12. Answer: b)

13. When implementing custom directory permissions for multi-user collaboration, which combination of commands correctly sets the desired permissions and umask value?

a)
$ umask 007
$ mkdir shared_collab
$ chmod g+s shared_collab
$ chmod 2770 shared_collab

b)
$ umask 027
$ mkdir shared_collab
$ chmod g+s shared_collab
$ chmod 750 shared_collab

c)
$ umask 002
$ mkdir shared_collab
$ chmod g+s shared_collab
$ chmod 755 shared_collab

d)
$ umask 022
$ mkdir shared_collab
$ chmod g+s shared_collab
$ chmod 770 shared_collab
/* --------------------- */

--------------------------

Answer 13 Below: 

--------------------------

/* --------------------- */

Explanation:
To implement custom directory permissions for multi-user collaboration, the correct combination of commands is to set the umask value to 002, create the directory, enable the setgid attribute with chmod g+s, and set the permissions to 755. This grants read, write, and execute access to the file owner, read and execute access to the group, and read and execute access to others.


Option a) is incorrect because it sets a less restrictive umask value, allowing more permissive permissions for the group and others.
Option b) is incorrect because it sets a more restrictive umask value, denying write access to the group.
Option d) is incorrect because it sets a less permissive permission of 770, granting unnecessary write access to the group and others. 
 
13. Answer: c)

 

Disclaimer: 

The samples provided here are intended to serve as a general guide and reference for individuals preparing for the LPI Linux certifications. These samples are not meant to represent the exact questions that may appear on the actual exam. The LPI certification exams are constantly updated and revised, and the questions on each exam are carefully crafted to assess a candidate's knowledge and skills.

Therefore, while I have made every effort to ensure the accuracy and relevance of the samples provided, I cannot guarantee that they will reflect the content or difficulty level of the actual exam. Additionally, I do not endorse or have any affiliation with the Linux Professional Institute (LPI).

I strongly recommend that candidates use these samples as an additional resource for their exam preparation, in combination with other study materials and practice tests. Ultimately, success on the LPI Linux certification exams will depend on an individual's knowledge, experience, and understanding of the exam objectives.
 
By using these samples, you agree that neither the provider of these sample questions nor any of its affiliates or employees shall be liable for any damages arising from your use or reliance on these sample questions or any information provided herein.
 

Comments

Popular Posts