LPI E C1 - chmod test

LPI Linux Essentials / C1

Knowledge Domain Topic 5: 

Security and File Permissions

 

Practice Test Questions:

1. You want to modify the permissions of the directory "sensitive-docs" to make it more private. Which command would you use?
a) chmod o-rwx sensitive-docs/
b) chmod u-rwx sensitive-docs/
c) chmod a-rwx sensitive-docs/
d) chmod g-rwx sensitive-docs/
/* --------------------- */

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

Answer 1 Below: 

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

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

Explanation:
The command "chmod o-rwx" removes read, write, and execute permissions for others (users who are not the owner or part of the group) on the "sensitive-docs" directory, making it more private.
 
Answer 1: a) chmod o-rwx sensitive-docs/

2. You need to view the permissions of the directory "top-secret" without displaying its contents. Which command would you use?
a) ls -l top-secret/
b) ls -d top-secret/
c) ls -la top-secret/
d) ls -ld top-secret/
/* --------------------- */

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

Answer 2 Below: 

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

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

Explanation:
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.
 
Answer 2: d) ls -ld top-secret/

3. You want to grant read and write permissions to the user owner and group owner of the file "confidential-file." Which command should you use?
a) chmod u+rw,g+rw confidential-file
b) chmod u=rw,g=rw confidential-file
c) chmod a+rw confidential-file
d) chmod o+rw confidential-file
/* --------------------- */

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

Answer 3 Below: 

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

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

Explanation:
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.
 
Answer 3: a) chmod u+rw,g+rw confidential-file

4. You want to remove execute permission for the group owner and others on the directory "secure-folder." Which command would you use?
a) chmod g-x,o-x secure-folder/
b) chmod u-x secure-folder/
c) chmod a-x secure-folder/
d) chmod ugo-x secure-folder/
/* --------------------- */

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

Answer 4 Below: 

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

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

Explanation:
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.


4. Answer: a) chmod g-x,o-x secure-folder/

5. You need to set exact permissions of read, write, and execute for the user owner, read and execute for the group owner, and read-only for others on the file "important-script." Which command should you use?
a) chmod u=rwx,g=rx,o=r important-script
b) chmod ug=rwx,o=r important-script
c) chmod a=rwx important-script
d) chmod o=rwx important-script
/* --------------------- */

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

Answer 5 Below: 

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

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

Explanation:
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

6. You want to grant read and write permissions to the user owner, group owner, and others for the directory "shared-folder." Which command should you use?
a) chmod u=rw,g=rw,o=rw shared-folder/
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: 

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

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

Explanation:
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/

7. You need to add execute permission for the user owner and group owner on the file "important-program." Which command would you use?
a) chmod u+x,g+x important-program
b) chmod ugo+x important-program
c) chmod o+x important-program
d) chmod g+x important-program
/* --------------------- */

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

Answer 7 Below: 

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

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

Explanation:
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

8. You want to grant read and execute permissions to the group owner and others for the directory "public-folder." Which command should you use?

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: 

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

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

Explanation:
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/

9. You need to remove read and write permissions for the user owner and group owner on the file "restricted-file." Which command would you use?
a) chmod u-rw,g-rw restricted-file
b) chmod ugo-rw restricted-file
c) chmod a-rw restricted-file
d) chmod g-rw restricted-file
/* --------------------- */

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

Answer 9 Below: 

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

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

Explanation:
The command "chmod u-rw,g-rw" removes read and write permissions for the user owner and group owner of the file "restricted-file."


Answer 9: a) chmod u-rw,g-rw restricted-file

10. You want to grant read, write, and execute permissions to everyone for the file "shared-script." Which command should you use?
a) chmod a+rwx shared-script
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

Popular posts from this blog

Why Certifications Methods?

LPI E - ALL K.D.

CCNP 03 - WANS