Permissions and Ownership Flashcards

(71 cards)

1
Q

Which of the following chmod commands adds execute permission for only the file owner?

πŸ”˜ Options
A. a+x
B. u+x
C. g+x
D. o+x

A

βœ… Correct Answer
B. u+x

πŸ’‘ Explanation
A. ❌ Adds execute for all users (user, group, others).
B. βœ… Correct β€” u+x adds execute permission for the file owner (user) only.
C. ❌ Affects only the group.
D. ❌ Affects only others.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following commands removes write permission from others without affecting the file owner or group?

πŸ”˜ Options
A. chmod a-w file.txt
B. chmod u-w file.txt
C. chmod o-w file.txt
D. chmod g-w file.txt

A

βœ… Correct Answer
C. chmod o-w file.txt

πŸ’‘ Explanation
A. ❌ Removes write permission from everyone, including the user.
B. ❌ Removes write from the owner.
C. βœ… Correct β€” removes write permission from others only.
D. ❌ Affects only the group.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If you want every user (owner, group, and others) to have execute permission on a file, which command should you use?

πŸ”˜ Options
A. u+x
B. g+x
C. o+x
D. a+x

A

βœ… Correct Answer
D. a+x

πŸ’‘ Explanation
A. ❌ Adds execute only for the owner.
B. ❌ Adds execute for group only.
C. ❌ Adds execute for others only.
D. βœ… Correct β€” a+x gives execute permission to all users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the command chmod -R 755 /var/www/html do?

πŸ”˜ Options
A. Changes one file’s permissions only
B. Adds execute permission for the user
C. Recursively applies 755 permissions
D. Removes write permission from others

A

βœ… Correct Answer
C. Recursively applies 755 permissions

πŸ’‘ Explanation
A. ❌ -R indicates multiple files and directories, not a single file.
B. ❌ Only adding execute would use symbolic syntax.
C. βœ… Correct β€” -R recursively changes permissions for all items inside the directory.
D. ❌ This command doesn’t specifically remove permissions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you display the default permissions for new files in a symbolic (human-readable) format?

πŸ”˜ Options
A. chmod -S
B. umask
C. umask -S
D. ls -l

A

βœ… Correct Answer
C. umask -S

πŸ’‘ Explanation
A. ❌ chmod doesn’t show default permissions.
B. ❌ Shows numeric format, not symbolic.
C. βœ… Correct β€” umask -S displays symbolic default permission mask.
D. ❌ Lists permissions of existing files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which chmod option will suppress error messages if a file doesn’t exist?

πŸ”˜ Options
A. -v
B. -c
C. -f
D. -R

A

βœ… Correct Answer
C. -f

πŸ’‘ Explanation
A. ❌ -v provides verbose output; it does not suppress errors.
B. ❌ -c shows changes, but doesn’t hide errors.
C. βœ… Correct β€” -f stands for β€œforce” and suppresses error messages.
D. ❌ -R makes the command recursive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which chmod option will show output only if a file’s permissions are actually changed?

πŸ”˜ Options
A. -v
B. -f
C. -R
D. -c

A

βœ… Correct Answer
D. -c

πŸ’‘ Explanation
A. ❌ -v always prints output, even if nothing changed.
B. ❌ -f suppresses output entirely.
C. ❌ -R is for recursive changes, not output behavior.
D. βœ… Correct β€” -c prints only if the permission was actually changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the key difference between chmod and umask?

πŸ”˜ Options
A. Both modify current permissions
B. umask edits current permissions
C. chmod changes default permissions for new files
D. chmod modifies existing files, umask sets defaults

A

βœ… Correct Answer
D. chmod modifies existing files, umask sets defaults

πŸ’‘ Explanation
A. ❌ Only chmod modifies existing permissions.
B. ❌ umask defines default permissions for new files, not current ones.
C. ❌ chmod does not affect new files.
D. βœ… Correct β€” chmod affects current files; umask sets default creation rules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which command configures the default permission mask for newly created files and directories?

πŸ”˜ Options
A. chmod
B. ls -l
C. umask
D. stat

A

βœ… Correct Answer
C. umask

πŸ’‘ Explanation
A. ❌ chmod affects only existing files.
B. ❌ ls -l shows file permissions, but doesn’t set defaults.
C. βœ… Correct β€” umask sets default permission rules for new files.
D. ❌ stat is used to view detailed file metadata.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If you want to print a message every time you attempt to change file permissions β€” even if the permissions don’t change β€” which chmod option should you use?

πŸ”˜ Options
A. -c
B. -R
C. -v
D. -f

A

βœ… Correct Answer
C. -v

πŸ’‘ Explanation
A. ❌ -c shows output only when changes occur.
B. ❌ -R affects directories recursively but doesn’t control output.
C. βœ… Correct β€” -v stands for β€œverbose” and prints messages regardless of change.
D. ❌ -f suppresses output entirely.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When a new file is created in Linux, the system starts with a default permission value. What is the default permission for files before applying the umask?

πŸ”˜ Options
A. 777 (rwxrwxrwx)
B. 666 (rw-rw-rw-)
C. 600 (rwβ€”β€”-)
D. 644 (rw-r–r–)

A

βœ… Correct Answer
B. 666 (rw-rw-rw-)

πŸ’‘ Explanation
A. ❌ 777 is the default for directories, not files.
B. βœ… Correct β€” files start with 666 so they are readable and writable, but not executable by default.
C. ❌ 600 is a possible result after applying a strict umask.
D. ❌ 644 is a common final result, not the default base.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following best describes the role of umask in Linux file creation?

πŸ”˜ Options
A. It sets exact permissions for each new file
B. It adds permissions to the default mode
C. It subtracts from the default permissions to get the final mode
D. It applies executable permission to new scripts

A

βœ… Correct Answer
C. It subtracts from the default permissions to get the final mode

πŸ’‘ Explanation
A. ❌ umask doesn’t set; it modifies.
B. ❌ It subtracts, not adds.
C. βœ… Correct β€” umask subtracts from the default (666 for files, 777 for dirs).
D. ❌ It doesn’t automatically add execute permission.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

If the umask value is set to 0022, what will be the final permission for a newly created directory?

πŸ”˜ Options
A. 777
B. 755
C. 775
D. 644

A

βœ… Correct Answer
B. 755

πŸ’‘ Explanation
A. ❌ 777 is the base, not the final result.
B. βœ… Correct β€” 777 - 022 = 755 β†’ rwxr-xr-x.
C. ❌ 775 is used with umask 0002.
D. ❌ 644 is for files, not directories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following explains why new files don’t have execute (x) permission by default?

πŸ”˜ Options
A. umask always strips execute permission
B. Files don’t need execute permission
C. For security, the system prevents automatic execution
D. It depends on the filesystem used

A

βœ… Correct Answer
C. For security, the system prevents automatic execution

πŸ’‘ Explanation
A. ❌ umask may allow execute, but files still won’t get it.
B. ❌ Scripts and binaries do need execute, but must request it.
C. βœ… Correct β€” Linux avoids giving execute by default for safety.
D. ❌ It’s a system-level behavior, not filesystem-dependent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What would be the final permission for a newly created file if umask is set to 0077?

πŸ”˜ Options
A. rw-r–r–
B. rw-rw-rw-
C. rwβ€”β€”-
D. rwxβ€”β€”

A

βœ… Correct Answer
C. rwβ€”β€”-

πŸ’‘ Explanation
A. ❌ This would happen with umask 0022.
B. ❌ This is the starting point (666), not the result.
C. βœ… Correct β€” 666 - 077 = 600 β†’ rwβ€”β€”-.
D. ❌ That’s for directories, not files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which umask value results in files that are only accessible by the owner and completely private?

πŸ”˜ Options
A. 0000
B. 0022
C. 0077
D. 0777

A

βœ… Correct Answer
C. 0077

πŸ’‘ Explanation
A. ❌ 0000 makes files open to everyone.
B. ❌ Allows group and others to read files.
C. βœ… Correct β€” 0077 removes all permissions for group and others.
D. ❌ Invalid; umask values only go up to 0777.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

When you run umask -S in the terminal, what type of output should you expect?

πŸ”˜ Options
A. Numeric value like 0022
B. Script name
C. Symbolic format like u=rwx,g=rx,o=rx
D. File listing with permissions

A

βœ… Correct Answer
C. Symbolic format like u=rwx,g=rx,o=rx

πŸ’‘ Explanation
A. ❌ That’s the output from just umask.
B. ❌ That’s unrelated to umask.
C. βœ… Correct β€” umask -S shows symbolic permission settings.
D. ❌ ls -l provides file listings, not umask.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which of the following best describes the permission outcome of a newly created folder when umask is set to 0077?

πŸ”˜ Options
A. rwxr-xr-x
B. rwxβ€”β€”
C. rwxrwxrwx
D. rwβ€”β€”-

A

βœ… Correct Answer
B. rwxβ€”β€”

πŸ’‘ Explanation
A. ❌ That’s the result with umask 0022.
B. βœ… Correct β€” 777 - 077 = 700 β†’ rwxβ€”β€”.
C. ❌ That’s the base before umask.
D. ❌ That’s for files, not folders.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

After setting umask 0077, you create a file using touch myfile.txt. What permissions should you expect?

πŸ”˜ Options
A. rw-r–r–
B. rwβ€”β€”-
C. rwxβ€”β€”
D. rwxrwxrwx

A

βœ… Correct Answer
B. rwβ€”β€”-

πŸ’‘ Explanation
A. ❌ That would happen with umask 0022.
B. βœ… Correct β€” 666 - 077 = 600 β†’ rwβ€”β€”-.
C. ❌ Execute is not given to files by default.
D. ❌ That’s the starting value, not final permissions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Which of the following statements about dotfiles (e.g., .bashrc) is true?

πŸ”˜ Options
A. They are always executable files
B. They are usually system logs
C. They are typically hidden configuration or script files
D. They are only used by root users

A

βœ… Correct Answer
C. They are typically hidden configuration or script files

πŸ’‘ Explanation
A. ❌ Not all dotfiles are executable.
B. ❌ Log files are not usually dotfiles.
C. βœ… Correct β€” dotfiles like .bashrc are usually hidden scripts or configs.
D. ❌ Regular users have dotfiles too (e.g., .profile, .bash_history).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Which of the following commands would you use to change both the owner and group of a file named report.txt to alice and devs respectively?

πŸ”˜ Options
A. chgrp alice:devs report.txt
B. chown alice devs report.txt
C. chown alice:devs report.txt
D. chgrp alice devs report.txt

A

βœ… Correct Answer
C. chown alice:devs report.txt

πŸ’‘ Explanation
A. ❌ chgrp only changes the group, and syntax is incorrect here.
B. ❌ chown with two separate arguments is invalid.
C. βœ… Correct β€” chown user:group filename changes both owner and group.
D. ❌ chgrp doesn’t support changing the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

You want to change only the group of a file without modifying the file’s current owner. Which chown syntax would you use?

πŸ”˜ Options
A. chown user: file.txt
B. chown :group file.txt
C. chown file.txt :group
D. chown group: file.txt

A

βœ… Correct Answer
B. chown :group file.txt

πŸ’‘ Explanation
A. ❌ Syntax is incomplete β€” it implies a group is missing.
B. βœ… Correct β€” using chown :group file.txt changes just the group.
C. ❌ Syntax is reversed and invalid.
D. ❌ group: format isn’t valid for chown.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Which command is specifically designed to change the group ownership of a file only?

πŸ”˜ Options
A. chmod
B. chown
C. chgrp
D. umask

A

βœ… Correct Answer
C. chgrp

πŸ’‘ Explanation
A. ❌ chmod changes permissions, not ownership.
B. ❌ chown can change both user and group, but is not exclusive to group.
C. βœ… Correct β€” chgrp is dedicated to group ownership changes.
D. ❌ umask controls default permissions, not ownership.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
You run the following command: sudo chown :admins file.txt. What does it do? πŸ”˜ Options A. Changes the owner and group to admins B. Only changes the group to admins C. Only changes the owner to admins D. Deletes the current group
βœ… Correct Answer B. Only changes the group to admins πŸ’‘ Explanation A. ❌ Owner is unchanged β€” only group is modified. B. βœ… Correct β€” chown :group modifies only the group. C. ❌ The owner is not affected unless specified. D. ❌ chown never deletes anything.
26
You run the following command: sudo chgrp admins myfile.txt. What will it change? πŸ”˜ Options A. The owner of myfile.txt B. The file permissions C. The group associated with myfile.txt D. Nothing β€” the command is invalid
βœ… Correct Answer C. The group associated with myfile.txt πŸ’‘ Explanation A. ❌ chgrp doesn't change the user owner. B. ❌ chmod is used to change permissions. C. βœ… Correct β€” chgrp changes group ownership only. D. ❌ The command is valid.
27
What is the result of running chown mousa:admins file.txt? πŸ”˜ Options A. Changes only the file owner to mousa B. Changes only the group to admins C. Changes both owner to mousa and group to admins D. Changes file permissions to 777
βœ… Correct Answer C. Changes both owner to mousa and group to admins πŸ’‘ Explanation A. ❌ That would be chown mousa file.txt. B. ❌ That would be chown :admins file.txt. C. βœ… Correct β€” both values are modified. D. ❌ Ownership changes don’t affect file permissions.
28
If a file shows this output: -rw-r--r-- 1 mousa devs myfile.txt, which field indicates the group owner? πŸ”˜ Options A. -rw-r--r-- B. 1 C. mousa D. devs
βœ… Correct Answer D. devs πŸ’‘ Explanation A. ❌ This is the permission string. B. ❌ This shows the link count. C. ❌ This is the file owner. D. βœ… Correct β€” group ownership is the second name after the owner.
29
You want to make a file belong to the data group without affecting the current user owner. What’s the simplest way to do that? πŸ”˜ Options A. chown data file.txt B. chgrp data file.txt C. chmod data file.txt D. chown : file.txt
βœ… Correct Answer B. chgrp data file.txt πŸ’‘ Explanation A. ❌ chown expects a username or user:group format. B. βœ… Correct β€” chgrp is designed for changing only the group. C. ❌ chmod changes permissions, not ownership. D. ❌ Syntax is incomplete.
30
Which command is equivalent to chown :admins file.txt in function? πŸ”˜ Options A. chmod +x file.txt B. umask 0022 C. chgrp admins file.txt D. chown file.txt :admins
βœ… Correct Answer C. chgrp admins file.txt πŸ’‘ Explanation A. ❌ Adds execute permission, unrelated to ownership. B. ❌ Sets default permissions, not ownership. C. βœ… Correct β€” both change only the group. D. ❌ Incorrect syntax.
31
Why might someone use chgrp instead of chown when modifying file ownership? πŸ”˜ Options A. chgrp is faster and changes both owner and group B. chgrp is simpler for group changes and doesn't affect the user C. chgrp also modifies file permissions D. chgrp can only be used by the root user
βœ… Correct Answer B. chgrp is simpler for group changes and doesn't affect the user πŸ’‘ Explanation A. ❌ chgrp only changes the group, not both. B. βœ… Correct β€” it’s simpler and avoids modifying the user owner. C. ❌ Ownership and permissions are separate. D. ❌ Regular users can use chgrp on files they own.
32
Which of the following best explains why the passwd command allows a normal user to update their password, even though the /etc/shadow file is owned by root? πŸ”˜ Options A. It uses ACLs to grant access B. It runs as a background service C. It has the SUID bit set D. It’s part of the sudoers group
βœ… Correct Answer C. It has the SUID bit set πŸ’‘ Explanation A. ❌ ACLs control access, but not ownership-based execution. B. ❌ passwd is not a service. C. βœ… Correct β€” passwd has the SUID bit set, so it runs with root’s privileges. D. ❌ The user doesn’t need to be a sudoer to use passwd.
33
What is the primary security benefit of using the SUID bit on certain trusted programs? πŸ”˜ Options A. It encrypts the file during execution B. It allows full root access to users C. It provides just enough privilege to complete a specific task D. It replaces the need for sudo entirely
βœ… Correct Answer C. It provides just enough privilege to complete a specific task πŸ’‘ Explanation A. ❌ SUID doesn’t encrypt files. B. ❌ It doesn’t give full root access. C. βœ… Correct β€” it gives temporary elevated rights for a narrow task. D. ❌ SUID is for specific programs, not general privilege escalation.
34
Which of the following users can set the SUID bit on a file owned by root? πŸ”˜ Options A. Any user who owns the file B. Only users in the wheel group or sudoers file C. Any member of the file’s group D. No one β€” only root can do tha
βœ… Correct Answer B. Only users in the wheel group or sudoers file πŸ’‘ Explanation A. ❌ File owners can’t set SUID unless they are root. B. βœ… Correct β€” SUID on root-owned files can only be set by users with sudo privileges. C. ❌ Group members don’t have that power. D. ❌ Sudoers can also set it.
35
What happens when a regular user runs a file with the SUID bit set and the file is owned by root? πŸ”˜ Options A. The file runs with the user's regular permissions B. The file runs with the root user's permissions C. The user becomes root until logout D. The file becomes writable by everyone
βœ… Correct Answer B. The file runs with the root user's permissions πŸ’‘ Explanation A. ❌ That’s standard behavior without SUID. B. βœ… Correct β€” the file executes with the owner's (root’s) privileges. C. ❌ SUID only elevates during execution, not system-wide. D. ❌ SUID doesn’t affect file writability.
36
What does the SGID bit do when applied to a directory? πŸ”˜ Options A. Makes the directory executable B. Prevents files from being deleted C. Forces all new files to inherit the directory’s group D. Locks the directory to the owner
βœ… Correct Answer C. Forces all new files to inherit the directory’s group πŸ’‘ Explanation A. ❌ Executability is unrelated. B. ❌ That’s the sticky bit. C. βœ… Correct β€” SGID on directories enforces group inheritance. D. ❌ Group, not ownership, is affected.
37
What does chmod 2775 /shared do? πŸ”˜ Options A. Applies sticky bit and 775 permissions B. Adds the SGID bit and sets standard permissions C. Sets the directory as read-only D. Grants execute permissions to everyone
βœ… Correct Answer B. Adds the SGID bit and sets standard permissions πŸ’‘ Explanation A. ❌ Sticky bit uses 1###. B. βœ… Correct β€” 2 = SGID, and 775 = rwxrwxr-x. C. ❌ It allows writing (7 includes write). D. ❌ Execute permissions are limited by the x bits.
38
How can a user remove the SUID or SGID bit from a file? πŸ”˜ Options A. Use chattr -i B. Use chmod -s C. Use lsattr -r D. Use chown to change owner
βœ… Correct Answer B. Use chmod -s πŸ’‘ Explanation A. ❌ chattr manages file attributes, not permission bits. B. βœ… Correct β€” chmod -s removes special permissions like SUID and SGID. C. ❌ lsattr just lists attributes. D. ❌ Changing ownership won’t remove special bits.
39
Which of the following statements best describes the sticky bit? πŸ”˜ Options A. Prevents any write operation in a directory B. Allows only the file owner or root to delete files within a directory C. Grants full control of a file to the user D. Hides the directory from ls
βœ… Correct Answer B. Allows only the file owner or root to delete files within a directory πŸ’‘ Explanation A. ❌ Writing is still allowed. B. βœ… Correct β€” sticky bit protects files from deletion by others. C. ❌ Control is based on permissions, not the sticky bit. D. ❌ Use dotfiles or chmod for hiding.
40
Which attribute would you set to make a file immutable, meaning it cannot be modified, renamed, or deleted? πŸ”˜ Options A. a B. c C. d D. i
βœ… Correct Answer D. i πŸ’‘ Explanation A. ❌ a is for append-only. B. ❌ c means compressed. C. ❌ d excludes from backups. D. βœ… Correct β€” i makes a file immutable.
41
What command would you use to view special file attributes like immutability or append-only? πŸ”˜ Options A. ls -l B. lsattr C. getfacl D. chmod
βœ… Correct Answer B. lsattr πŸ’‘ Explanation A. ❌ Shows standard permissions only. B. βœ… Correct β€” lsattr lists extended attributes. C. ❌ getfacl shows ACL entries. D. ❌ chmod changes permissions, doesn’t display them.
42
Which command makes a file append-only, meaning content can be added but not changed or deleted? πŸ”˜ Options A. chmod +a B. setfacl -m a C. chattr +a D. lsattr +a
βœ… Correct Answer C. chattr +a πŸ’‘ Explanation A. ❌ That’s not a valid chmod flag. B. ❌ ACLs don’t define append-only behavior. C. βœ… Correct β€” chattr +a sets the append-only attribute. D. ❌ lsattr only lists attributes.
43
You want to prevent accidental deletion of a config file like /etc/passwd. What’s the best approach? πŸ”˜ Options A. Remove all permissions B. Use chmod 000 C. Set the immutable attribute with chattr +i D. Add a sticky bit to the file
βœ… Correct Answer C. Set the immutable attribute with chattr +i πŸ’‘ Explanation A. ❌ That may prevent access, but not changes by root. B. ❌ Root can still change it. C. βœ… Correct β€” chattr +i locks the file completely. D. ❌ Sticky bit is for directories.
44
Which of the following commands grants read access to john for report.txt without changing file ownership? πŸ”˜ Options A. chmod o+r report.txt B. chown john report.txt C. setfacl -m u:john:r-- report.txt D. chattr +r report.txt
βœ… Correct Answer C. setfacl -m u:john:r-- report.txt πŸ’‘ Explanation A. ❌ Affects all others, not specifically john. B. ❌ Transfers ownership. C. βœ… Correct β€” ACL allows custom user-specific access. D. ❌ No such +r option in chattr.
45
Which of the following best describes the purpose of the mask line in an ACL? πŸ”˜ Options A. It defines permissions for the owner B. It controls what permissions others have C. It limits maximum allowed ACL permissions for any user or group D. It hides ACL entries from view
βœ… Correct Answer C. It limits maximum allowed ACL permissions for any user or group πŸ’‘ Explanation A. ❌ That’s user::. B. ❌ That’s other::. C. βœ… Correct β€” mask:: sets the upper boundary of ACL effectiveness. D. ❌ ACL entries are always visible.
46
What does the command setfacl -b file.txt do? πŸ”˜ Options A. Blocks access to the file B. Removes all ACL entries from the file C. Backs up the ACL settings D. Breaks the file’s permissions
βœ… Correct Answer B. Removes all ACL entries from the file πŸ’‘ Explanation A. ❌ Does not block standard access. B. βœ… Correct β€” -b clears all ACLs, leaving only standard permissions. C. ❌ Use getfacl for exporting ACLs. D. ❌ Permissions are reset, not broken.
47
What does the SGID permission on a directory do when a new file is created within it? πŸ”˜ Options A. Sets the new file’s owner to root B. Gives write access to all users C. Ensures the file inherits the directory’s group D. Makes the file read-only
βœ… Correct Answer C. Ensures the file inherits the directory’s group πŸ’‘ Explanation A. ❌ Ownership remains with the creator. B. ❌ Write access depends on file permissions. C. βœ… Correct β€” SGID on directories causes new files to inherit the directory's group. D. ❌ File permissions are not automatically set to read-only.
48
If SGID is applied to a directory, which of the following scenarios would prevent it from working as expected? πŸ”˜ Options A. The directory has 777 permissions B. The group assigned to the directory does not exist C. The user is a member of the assigned group D. The directory is owned by root
βœ… Correct Answer B. The group assigned to the directory does not exist πŸ’‘ Explanation A. ❌ SGID can still work with 777 permissions. B. βœ… Correct β€” the group must exist and the user must belong to it for SGID to work as expected. C. ❌ This is required for SGID to work properly. D. ❌ Ownership doesn't prevent SGID behavior.
49
Which command sets the sticky bit on a directory? πŸ”˜ Options A. chmod 775 folder B. chmod +s folder C. chmod +t folder D. chattr +i folder
βœ… Correct Answer C. chmod +t folder πŸ’‘ Explanation A. ❌ Does not set any special permissions. B. ❌ +s is for SUID or SGID. C. βœ… Correct β€” +t sets the sticky bit. D. ❌ chattr +i makes the file immutable.
50
Which of the following does the sticky bit specifically prevent? πŸ”˜ Options A. Users from modifying their own files B. Users from reading directory contents C. Users from deleting files they do not own D. Root from deleting files
βœ… Correct Answer C. Users from deleting files they do not own πŸ’‘ Explanation A. ❌ Users can still modify their own files. B. ❌ Sticky bit doesn’t control read access. C. βœ… Correct β€” only file owners (or root) can delete files when sticky bit is set. D. ❌ Root can always delete files.
51
What does the + sign at the end of a file’s permissions (e.g. drwxrwxrwx+) indicate? πŸ”˜ Options A. The file is encrypted B. The file is immutable C. ACLs are applied D. SGID is set
βœ… Correct Answer C. ACLs are applied πŸ’‘ Explanation A. ❌ Encryption is not indicated by +. B. ❌ Immutability shows with i via lsattr. C. βœ… Correct β€” + means the file has Access Control Lists applied. D. ❌ SGID shows as s in the group execute position.
52
What does chattr +i filename do? πŸ”˜ Options A. Gives the file read-only permissions B. Sets the file as immutable C. Compresses the file D. Adds execute permission
βœ… Correct Answer B. Sets the file as immutable πŸ’‘ Explanation A. ❌ Read-only can still be removed by chmod. B. βœ… Correct β€” +i prevents any changes to the file, even by root. C. ❌ +c would be for compression. D. ❌ chmod +x adds execute permission.
53
After setting the sticky bit on a shared directory, a user can still delete a file. What is the most likely reason? πŸ”˜ Options A. The sticky bit was not set correctly B. The user owns the file C. The directory does not have write permissions D. The file has execute permissions
βœ… Correct Answer B. The user owns the file πŸ’‘ Explanation A. ❌ Sticky bit might be correctly set. B. βœ… Correct β€” sticky bit prevents deletion only of others' files. C. ❌ This would prevent all changes. D. ❌ Execute permission does not affect deletion.
54
What does the e character in lsattr output indicate? πŸ”˜ Options A. The file is encrypted B. The file is owned by root C. The file uses extents for storage D. The file is executable
βœ… Correct Answer C. The file uses extents for storage πŸ’‘ Explanation A. ❌ Not related to encryption. B. ❌ Ownership is shown by ls -l. C. βœ… Correct β€” e means extents, used for efficient storage on ext3/ext4. D. ❌ Execute permission is unrelated to this flag.
55
Can the sticky bit be applied to regular files in modern Linux systems? πŸ”˜ Options A. Yes, and it provides caching benefits B. Yes, but only on ext2 C. No, it's ignored when used on files D. No, it causes an error
βœ… Correct Answer C. No, it's ignored when used on files πŸ’‘ Explanation A. ❌ That was true in older Unix versions. B. ❌ Still ignored in modern usage. C. βœ… Correct β€” sticky bit only applies to directories now. D. ❌ It doesn't error β€” it's just ignored.
56
What is a key difference between using the sticky bit and the immutable bit? πŸ”˜ Options A. Sticky bit restricts access to root B. Immutable bit allows renaming but not deletion C. Sticky bit is used in shared folders, immutable bit freezes files D. Sticky bit hides the file
βœ… Correct Answer C. Sticky bit is used in shared folders, immutable bit freezes files πŸ’‘ Explanation A. ❌ Sticky bit doesn't restrict root. B. ❌ Immutable blocks renaming too. C. βœ… Correct β€” sticky protects shared files, immutable completely locks a file. D. ❌ Neither bit hides files.
57
Which of the following permissions schemes will not show the effects of an ACL in a traditional ls -l listing? πŸ”˜ Options A. rwxrwxrwx B. rwxrwxrwx+ C. rwxr-xr-x D. rwxrwx--x
βœ… Correct Answer C. rwxr-xr-x πŸ’‘ Explanation A. ❌ This alone won’t show ACL, but it's valid. B. ❌ This does show ACL with the + sign. C. βœ… Correct β€” this shows standard permissions only, no ACL. D. ❌ Still standard permissions, no + means no ACL visible.
58
How many groups can a file or directory have assigned by default in Linux (without ACLs)? πŸ”˜ Options A. Unlimited B. Only one C. Two (primary and secondary) D. None
βœ… Correct Answer B. Only one πŸ’‘ Explanation A. ❌ Only with ACLs can multiple be assigned. B. βœ… Correct β€” standard Linux permissions allow one group per file or directory. C. ❌ Users can have multiple groups, but files cannot. D. ❌ Every file must have a group.
59
Which tool allows you to assign multiple group permissions to a file? πŸ”˜ Options A. chmod B. chown C. setfacl D. chattr
βœ… Correct Answer C. setfacl πŸ’‘ Explanation A. ❌ chmod only sets basic permissions. B. ❌ chown changes user and group ownership, not access. C. βœ… Correct β€” ACLs via setfacl let you assign multiple user/group rules. D. ❌ chattr sets attributes like immutability.
60
Why didn’t adding write access to a group using setfacl change the visible permissions in ls -l? πŸ”˜ Options A. ACL was applied incorrectly B. ACLs don’t affect ls -l output directly C. chmod must be rerun D. Only root can see ACLs
βœ… Correct Answer B. ACLs don’t affect ls -l output directly πŸ’‘ Explanation A. ❌ ACL may have worked fine. B. βœ… Correct β€” ACLs are layered and only hinted at with a + sign in ls -l. C. ❌ ACL doesn’t require chmod to show. D. ❌ Any user can check ACLs with getfacl.
61
If your file has the immutable attribute set, which of the following actions is possible? πŸ”˜ Options A. Rename the file B. Delete the file C. Append content to the file D. None of the above
βœ… Correct Answer D. None of the above πŸ’‘ Explanation A. ❌ Immutable prevents renaming. B. ❌ Immutable blocks deletion. C. ❌ Append requires the append-only attribute, not immutable. D. βœ… Correct β€” the file is completely locked.
62
Which command is the safest and most direct way to remove a user from a group in Linux? πŸ”˜ Options A. deluser username groupname B. usermod -r groupname username C. gpasswd -d username groupname D. groupdel username
βœ… Correct Answer C. gpasswd -d username groupname πŸ’‘ Explanation A. ❌ deluser isn't available on all systems. B. ❌ usermod does not use -r for removing users from groups. C. βœ… Correct β€” gpasswd -d safely removes a user from a group. D. ❌ groupdel deletes the group itself.
63
Which of the following commands shows the groups that a specific user belongs to? πŸ”˜ Options A. id groupname B. whoami groups C. groups username D. ls -l /etc/group
βœ… Correct Answer C. groups username πŸ’‘ Explanation A. ❌ id shows UID/GID, not all groups. B. ❌ This is an invalid combination. C. βœ… Correct β€” groups lists all groups a user belongs to. D. ❌ ls -l lists file metadata, not group membership.
64
What does the getent command do in Linux? πŸ”˜ Options A. Displays log files from systemd B. Edits file ownership and permissions C. Queries system databases like passwd, group, and hosts D. Scans the filesystem for broken permissions
βœ… Correct Answer C. Queries system databases like passwd, group, and hosts πŸ’‘ Explanation A. ❌ That’s journalctl. B. ❌ chown and chmod are for permissions. C. βœ… Correct β€” getent retrieves entries from local and remote sources. D. ❌ No scanning is involved.
65
Why is getent preferred over using cat /etc/passwd in modern Linux environments? πŸ”˜ Options A. It sorts user accounts alphabetically B. It modifies group memberships C. It supports both local and network-based entries D. It provides a GUI for managing users
βœ… Correct Answer C. It supports both local and network-based entries πŸ’‘ Explanation A. ❌ Sorting isn’t the goal. B. ❌ getent is read-only. C. βœ… Correct β€” it works with LDAP, NIS, and more, as well as local files. D. ❌ It’s a CLI tool, not GUI-based.
66
What file does getent consult to determine which sources to query for users, groups, and hosts? πŸ”˜ Options A. /etc/shadow B. /etc/nsswitch.conf C. /etc/sudoers D. /etc/login.defs
βœ… Correct Answer B. /etc/nsswitch.conf πŸ’‘ Explanation A. ❌ That file stores passwords, not query logic. B. βœ… Correct β€” this config file defines the source order (files, LDAP, etc.). C. ❌ Manages sudo permissions, not lookup behavior. D. ❌ Controls user defaults, not data sources.
67
Which command lists all users on a system using getent? πŸ”˜ Options A. getent group B. getent passwd C. getent users D. getent shadow
βœ… Correct Answer B. getent passwd πŸ’‘ Explanation A. ❌ Lists groups. B. βœ… Correct β€” getent passwd lists all user accounts. C. ❌ users is not a valid getent database. D. ❌ shadow contains sensitive password hashes, not user lists.
68
How can you check which users are members of the CryptoDept group using getent? πŸ”˜ Options A. getent passwd CryptoDept B. getent group CryptoDept C. groups CryptoDept D. cat /etc/sudoers | grep CryptoDept
βœ… Correct Answer B. getent group CryptoDept πŸ’‘ Explanation A. ❌ This queries user info, not group membership. B. βœ… Correct β€” shows group info including its members. C. ❌ groups is for checking a user’s groups, not a group’s users. D. ❌ Irrelevant to general group membership.
69
What would the command getent passwd emusk return? πŸ”˜ Options A. Group memberships of emusk B. Login session info for emusk C. The full passwd entry for emusk D. A list of emusk’s shell commands
βœ… Correct Answer C. The full passwd entry for emusk πŸ’‘ Explanation A. ❌ Use groups emusk for that. B. ❌ Use w or who for login sessions. C. βœ… Correct β€” shows UID, GID, home directory, and shell. D. ❌ Shell history is not part of this output.
70
Which of the following getent commands would show how localhost is resolved? πŸ”˜ Options A. getent host localhost B. getent hosts localhost C. getent passwd localhost D. getent group localhost
βœ… Correct Answer B. getent hosts localhost πŸ’‘ Explanation A. ❌ Wrong syntax. B. βœ… Correct β€” queries hostname resolution data from /etc/hosts and DNS. C. ❌ Queries users, not hosts. D. ❌ Queries groups.
71
What is a primary advantage of using getent in an LDAP-integrated environment? πŸ”˜ Options A. It allows changing LDAP passwords B. It provides user login statistics C. It retrieves user/group information from centralized directories D. It runs faster than ls
βœ… Correct Answer C. It retrieves user/group information from centralized directories πŸ’‘ Explanation A. ❌ Password changes require dedicated tools. B. ❌ Use last or w for that. C. βœ… Correct β€” getent is LDAP-aware and can pull data from network sources. D. ❌ Speed isn't the main benefit.