LPI E C1 - chmod test
LPI Linux Essentials / C1
Knowledge Domain Topic 5:
Security and File Permissions
Practice Test Questions:
b) chmod u-rwx sensitive-docs/
c) chmod a-rwx sensitive-docs/
d) chmod g-rwx sensitive-docs/
--------------------------
Answer 1 Below:
--------------------------
/* --------------------- */
Explanation:b) ls -d top-secret/
c) ls -la top-secret/
d) ls -ld top-secret/
--------------------------
Answer 2 Below:
--------------------------
/* --------------------- */
The command "ls -ld" is used to view the permissions of a directory, and the option "d" ensures that only the directory itself is displayed, rather than its contents. Therefore, "ls -ld top-secret/" would provide the desired output.
b) chmod u=rw,g=rw confidential-file
c) chmod a+rw confidential-file
d) chmod o+rw confidential-file
--------------------------
Answer 3 Below:
--------------------------
/* --------------------- */
The command "chmod u+rw,g+rw" grants read and write permissions to the user owner and group owner of the file "confidential-file." The "+rw" indicates adding read and write permissions for the respective entities.
b) chmod u-x secure-folder/
c) chmod a-x secure-folder/
d) chmod ugo-x secure-folder/
--------------------------
Answer 4 Below:
--------------------------
/* --------------------- */
The command "chmod g-x,o-x" removes execute permission for the group owner and others (users who are not the owner) on the "secure-folder" directory, restricting their ability to execute files within the directory.
b) chmod ug=rwx,o=r important-script
c) chmod a=rwx important-script
d) chmod o=rwx important-script
--------------------------
Answer 5 Below:
--------------------------
/* --------------------- */
The command "chmod u=rwx,g=rx,o=r" sets the exact permissions for the user owner (read, write, execute), the group owner (read, execute), and others (read) on the file "important-script."
Answer 5: a) chmod u=rwx,g=rx,o=r important-script
b) chmod u+w,g+w,o+w shared-folder/
c) chmod a=rw shared-folder/
d) chmod ugo=rw shared-folder/
--------------------------
Answer 6 Below:
--------------------------
/* --------------------- */
The command "chmod a=rw" grants read and write permissions to the user owner, group owner, and others (all entities) on the "shared-folder" directory.
Answer 6: c) chmod a=rw shared-folder/
b) chmod ugo+x important-program
c) chmod o+x important-program
d) chmod g+x important-program
--------------------------
Answer 7 Below:
--------------------------
/* --------------------- */
The command "chmod u+x,g+x" adds execute permission for the user owner and group owner of the file "important-program," allowing them to execute the file.
Answer 7: a) chmod u+x,g+x important-program
a) chmod g+rx,o+rx public-folder/
b) chmod u+rx public-folder/
c) chmod a+rx public-folder/
d) chmod go+rx public-folder/
--------------------------
Answer 8 Below:
--------------------------
/* --------------------- */
The command "chmod go+rx" grants read and execute permissions for the group owner and others (users who are not the owner) on the "public-folder" directory.
Answer 8: d) chmod go+rx public-folder/
b) chmod ugo-rw restricted-file
c) chmod a-rw restricted-file
d) chmod g-rw restricted-file
--------------------------
Answer 9 Below:
--------------------------
/* --------------------- */
The command "chmod u-rw,g-rw" removes read and write permissions for the user owner and group owner of the file "restricted-file."
b) chmod ugo+rwx shared-script
c) chmod o+rwx shared-script
d) chmod u+rwx shared-script
--------------------------
Answer 10 Below:
--------------------------
/* --------------------- */
Explanation:
The command "chmod ugo+rwx" grants read, write, and execute permissions to the user owner, group owner, and others (all entities) on the file "shared-script."
Answer 10: b) chmod ugo+rwx shared-script
11. You want to give the user owner read and write permissions on the file "important-data.txt" using octal notation.
Which numeric value should you use?
a) 5
b) 2
c) 6
d) 7
--------------------------
Answer 11 Below:
--------------------------
/* --------------------- */
Explanation:
In octal notation, read (r) is represented by 4 and
write (w) is represented by 2. To grant read and write permissions to
the user owner, the numeric value would be 6.You need to grant read and
execute permissions to the group owner and others on the script file
"run-script.sh" using symbolic notation.
Answer 11:
c) 6
12. You want to give the user owner read and write permissions on the file "important-data.txt" using octal notation.
Which command should you use?
a) chmod g+rx,o+rx run-script.sh
b) chmod u+rx run-script.sh
c) chmod a+rx run-script.sh
d) chmod go+rx run-script.sh
--------------------------
Answer 12 Below:
--------------------------
/* --------------------- */
Explanation:
The command "chmod g+rx,o+rx" grants read and execute permissions to the group owner and others (users who are not the owner) on the file "run-script.sh" using symbolic notation.
Answer 12: a) chmod g+rx,o+rx run-script.sh
13. You want to remove write permission for the user owner, group owner, and others on the directory "public-docs" using octal notation.
Which numeric value should you use?
a) 6
b) 2
c) 3
d) 0
--------------------------
Answer 13 Below:
--------------------------
/* --------------------- */
Explanation:
In octal notation, no permission is represented by 0. To remove write permission for the user owner, group owner, and others, the numeric value would be 0.
Answer 13: d) 0
14. You need to grant read, write, and execute permissions to everyone on the file "shared-file.txt" using symbolic notation.
Which command should you use?
a) chmod a+rwx shared-file.txt
b) chmod ugo+rwx shared-file.txt
c) chmod o+rwx shared-file.txt
d) chmod u+rwx shared-file.txt
--------------------------
Answer 14 Below:
--------------------------
/* --------------------- */
Explanation:
The command "chmod a+rwx" grants read, write, and execute permissions to the user owner, group owner, and others (all entities) on the file "shared-file.txt" using symbolic notation.
Answer 14: a) chmod a+rwx shared-file.txt
15. You want to set the permissions of the directory "private-folder" to read and execute for the user owner, write for the group owner, and no permissions for others using octal notation.
Which numeric value should you use?
a) 764
b) 714
c) 674
d) 754
--------------------------
Answer 15 Below:
--------------------------
/* --------------------- */
Explanation:
In octal notation, read (r) is represented by 4, write (w) is represented by 2, and execute (x) is represented by 1. To set the mentioned permissions, the numeric value would be 754.
Answer 15: d) 754
16. You
need to grant read and write permissions to the user owner and no
permissions for others on the file "restricted-data.txt" using symbolic
notation.
Which command should you use?
a) chmod u+rw,o-r restricted-data.txt
b) chmod u=rw,o= restricted-data.txt
c) chmod ugo+rw restricted-data.txt
d) chmod a-rw restricted-data.txt
--------------------------
Answer 16 Below:
--------------------------
/* --------------------- */
Explanation:
The command "chmod u+rw,o-r" grants read and write permissions to the user owner and removes all permissions for others on the file "restricted-data.txt" using symbolic notation.
Answer 16: a) chmod u+rw,o-r restricted-data.txt
17. You want to grant read and execute permissions to the group owner and others on the directory "public-docs" using octal notation.
Which numeric value should you use?
a) 764
b) 576
c) 654
d) 754
--------------------------
Answer 17 Below:
--------------------------
/* --------------------- */
Explanation:
In octal notation, read (r) is represented by 4 and execute (x) is represented by 1. To grant read and execute permissions to the group owner and others, the numeric value would be 654.
Answer 17: c) 654
18. You need to remove read and write permissions for the user owner, group owner, and others on the file "confidential-file.txt" using symbolic notation.
Which command should you use?
a) chmod ugo-rw confidential-file.txt
b) chmod u-rw,g-rw,o-rw confidential-file.txt
c) chmod a-rw confidential-file.txt
d) chmod g-rw confidential-file.txt
--------------------------
Answer 18 Below:
--------------------------
/* --------------------- */
Explanation: The command "chmod ugo-rw" removes read and write permissions for the user owner, group owner, and others on the file "confidential-file.txt" using symbolic notation.
Answer 18: a) chmod ugo-rw confidential-file.txt
19. You
want to grant write permission for the user owner, read permission for
the group owner, and no permissions for others on the file "data.txt"
using octal notation.
Which numeric value should you use?
a) 634
b) 724
c) 354
d) 714
--------------------------
Answer 19 Below:
--------------------------
/* --------------------- */
Explanation:
In octal notation, read (r) is represented by 4 and write (w) is represented by 2. To grant the mentioned permissions, the numeric value would be 714.
Answer 19: d) 714
20. You need to grant read and execute permissions to the user owner, write permission for the group owner, and execute permission for others on the file "script.sh" using symbolic notation.
Which command should you use?
a) chmod u+rx,g+w,o+x script.sh
b) chmod u+rwx,g+r,o+x script.sh
c) chmod a=r-x script.sh
d) chmod o-rwx script.sh
--------------------------
Answer 20 Below:
--------------------------
/* --------------------- */
Explanation:
The command "chmod u+rx,g+w,o+x" grants read and execute permissions to the user owner, write permission for the group owner, and execute permission for others on the file "script.sh" using symbolic notation.
Answer 20: a) chmod u+rx,g+w,o+x script.sh
Comments