Skip to main content

LPI E - GID UID Test

5.3 Managing File Permissions and Ownership

Understanding and manipulating file permissions and ownership settings

Practice Exam Scenarios 1

Scearios #2 Here: https://www.certificationmethods.com/2023/05/lpi-e-permissions-test.html

Scenario 1:

You are a system administrator managing a file server that stores sensitive data. You want to ensure that only the owner of a file can delete it, while other users have read and execute permissions. Which special permission should you set?

a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 1 Below: 

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

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

Explanation:
In this scenario, setting the Sticky Bit on the parent directory ensures that only the file owner can delete their files. The Sticky Bit restricts the deletion or renaming of files within a directory to the owner, even if other users have write permissions. This helps maintain data security and prevents accidental or unauthorized deletions.

Answer 1: a) Sticky Bit

Scenario 2:

You have a directory that is frequently accessed by multiple users. You want to ensure that any new files or directories created within it inherit the group ownership of the parent directory. Which special permission would you apply?

a) Sticky Bit
b) Set GID
c) Set UID
d) All of the above

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

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

Answer 2 Below: 

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

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

Explanation:
In this scenario, applying the Set GID permission to the parent directory ensures that new files or directories created within it inherit the group ownership. This promotes collaboration among users as they can access and modify each other's files while maintaining consistent group ownership within the directory.

Answer 2: b) Set GID

Scenario 3:

You want to grant a specific user temporary administrative privileges on a particular script file without compromising the security of the entire system. Which special permission should you apply?

a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 3 Below: 

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

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

Explanation:
In this scenario, applying the Set UID permission to the script file allows the user executing the script to temporarily assume the owner's privileges. This grants the user elevated permissions for the duration of script execution without granting permanent administrative privileges.

Answer 3: c) Set UID

Scenario 4:

You want to ensure that only the owner of a script file can execute it, while other users can read the file. However, you want to prevent accidental modifications to the file. Which special permission should you set?

a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 4 Below: 

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

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

Explanation:
In this scenario, the required permissions can be achieved through regular file permissions (read, write, and execute) without the need for any special permissions. By granting execute permissions to the file owner and read permissions to other users, you can achieve the desired access control and prevent accidental modifications.

Answer 4: d) None of the above

Scenario 5:

You are managing a shared directory where users frequently create and delete files. However, you want to restrict users from deleting files created by other users. Which special permission should you set?

a) Sticky Bit
b) Set GID
c) Set UID
d) All of the above

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

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

Answer 5 Below: 

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

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

Explanation:
In this scenario, setting the Sticky Bit on the shared directory ensures that users can only delete files they own. The Sticky Bit prevents users from deleting or renaming files created by other users, maintaining data integrity and preventing accidental or unauthorized deletions.

Answer 5: a) Sticky Bit

Scenario 6:

You have a directory that contains a set of executable files. You want to ensure that when these files are executed, they run with the privileges of the file owner. Which special permission should you apply?

a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 6 Below: 

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

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

Explanation:
In this scenario, applying the Set UID permission to the executable files allows them to run with the privileges of the file owner. When a file with Set UID permission is executed, it runs with the effective user ID of the file owner, granting it elevated privileges for that execution only.

Answer: c) Set UID

Scenario 7:

You are managing a directory where multiple users collaborate on projects. You want to ensure that any files or directories created within this directory have the same group ownership as the parent directory. Which special permission should you apply?

a) Sticky Bit
b) Set GID
c) Set UID
d) All of the above

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

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

Answer 7 Below: 

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

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

Explanation:
In this scenario, applying the Set GID permission to the parent directory ensures that any files or directories created within it inherit the group ownership from the parent directory. This facilitates collaboration among users by maintaining consistent group ownership within the project directory.

Answer 7: b) Set GID

Scenario 8:

You want to restrict the deletion or renaming of files within a directory to only the owner, even if other users have write permissions. However, the directory contains both files and subdirectories. Which special permission should you set?

a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 8 Below: 

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

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

Explanation:
In this scenario, setting the Sticky Bit on the directory ensures that only the file owner can delete or rename their files, regardless of other users' write permissions. The Sticky Bit applies to both files and subdirectories within the directory, providing a level of protection against accidental or unauthorized deletions.

Answer 8: a) Sticky Bit

Scenario 9:

You have a script file that needs to be executed with the privileges of the group that owns the file, regardless of the user executing it. Which special permission should you apply?

a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 9 Below: 

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

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

Explanation:
In this scenario, applying the Set GID permission to the script file ensures that when it is executed, the resulting process runs with the group privileges of the file owner. This allows users to execute the script with the associated group's permissions, promoting efficient and secure execution of the script.

Answer 9: b) Set GID

Scenario 10:

You want to prevent accidental modifications to a script file while still allowing execution by the owner and other users. Which special permission should you set?


a) Sticky Bit
b) Set GID
c) Set UID
d) None of the above

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

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

Answer 10 Below: 

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

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

Explanation: In this scenario, the required permissions can be achieved through regular file permissions (read, write, and execute) without the need for any special permissions. By granting execute permissions to the file owner and other users and restricting write permissions, you can allow execution while preventing accidental modifications to the script file. 

Answer 10: d) None of the above