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
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:
--------------------------
/* --------------------- */
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 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.
b) rw-rw-rw-
c) rwxr-xr-x
d) rwxrwx---
--------------------------
Answer 2 Below:
--------------------------
/* --------------------- */
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.
b) 022
c) 027
d) 077
--------------------------
Answer 3 Below:
--------------------------
/* --------------------- */
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-------.
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:
--------------------------
/* --------------------- */
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.
b) Guest
c) Root
d) Standard User
--------------------------
Answer 5 Below:
--------------------------
/* --------------------- */
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.
b) rwxr-xr--
c) rw-rw-r-x
d) rwxr-xr-x
--------------------------
Answer 6 Below:
--------------------------
/* --------------------- */
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.
b) chown
c) umask
d) touch
--------------------------
Answer 7 Below:
--------------------------
/* --------------------- */
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.
b) pwd
c) umask
d) chmod
--------------------------
Answer 8 Below:
--------------------------
/* --------------------- */
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.
b) rwxr-xr-x
c) rwxrwxr-x
d) rwxr-x---
--------------------------
Answer 9 Below:
--------------------------
/* --------------------- */
Explanation: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.
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.
Following Practice Exam Questions - Based Interstellar Voyage:
Read Here: https://www.certificationmethods.com/2023/05/lpi-e-umask-control.html
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:
--------------------------
/* --------------------- */
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.
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:
--------------------------
/* --------------------- */
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.
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:
--------------------------
/* --------------------- */
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.
Comments