Courseiva

CCNA Security And File Permissions Questions

60 questions · Security And File Permissions · All types, answers revealed

1
MCQeasy

You need to prevent a standard user from accidentally deleting a critical configuration file owned by root. Which command ensures the file cannot be modified or deleted even by the root user?

A.chown root:root file.conf
B.chmod 400 file.conf
C.umask 000
D.chattr +i file.conf
AnswerD

`chattr +i` sets the immutable attribute in the ext4 inode, blocking writes, renames and unlinks at the filesystem layer — even for root, until the attribute is cleared. This satisfies the stem's constraint that the file survive deletion by root, which standard Unix permissions cannot enforce.

Why this answer

The 'chattr +i' command sets the immutable attribute on a file, which prevents any modification, deletion, renaming, or even linking — even by the root user — until the attribute is removed with 'chattr -i'. This is the only option that satisfies the requirement of protecting the file from root itself.

Exam trap

The trap is assuming root is all-powerful — candidates pick chmod 400 or chown root:root thinking root ownership or read-only permissions stop root, but only filesystem attributes like +i can override root.

How to eliminate wrong answers

Option A is wrong because changing ownership to root:root does not prevent root from modifying or deleting the file — root can always override permissions. Option B is wrong because chmod 400 makes the file read-only for the owner, but root can still write to it or delete it (deletion depends on directory permissions, and root bypasses them). Option C is wrong because umask 000 makes newly created files more permissive, the opposite of protection, and it does not affect existing files.

2
MCQeasy

A junior administrator needs to change the permissions of the file /home/bob/notes.txt so that the owner can read and write, the group can read, and others have no access. Which command accomplishes this?

A.chmod 660 /home/bob/notes.txt
B.chmod 640 /home/bob/notes.txt
C.chmod 644 /home/bob/notes.txt
D.chmod 604 /home/bob/notes.txt
AnswerB

The numeric mode 640 translates to rw- for the owner (6), r-- for the group (4), and --- for others (0). This precisely matches the requirement: owner read/write, group read-only, others no access. It is the standard way to set these permissions in one command.

Why this answer

The octal permissions 640 map exactly to owner read/write, group read, and others none. This is a direct application of the numeric notation, where each digit represents the sum of read (4), write (2), and execute (1) for the respective category. No other listed mode matches the specified access levels.

Exam trap

The trap here is mixing up the order of the octal digits, such as placing the others permission in the group position, which leads to an incorrect mode.

3
Multi-Selecthard

An administrator creates the directory /srv/dropbox and runs 'chmod 1777 /srv/dropbox'. Users report they can create files there, but cannot delete files created by other users. Which TWO statements correctly describe this configuration? (Choose two.)

Select 2 answers
A.The leading '1' sets the sticky bit, which restricts deletion or renaming of entries to the file's owner, the directory's owner, or root.
B.The sticky bit on a directory prevents any user other than root from writing new files into that directory.
C.The trailing '777' grants read, write, and execute to owner, group, and others, allowing any user to create files in the directory.
D.Because the directory mode includes the execute bit for others, any user may delete any file within the directory.
E.The mode 1777 is invalid syntax, and the shell silently drops the leading digit, leaving the directory at 777.
AnswersA, C

On a directory, the sticky bit restricts removal and renaming so that only the file's owner, the directory's owner, or root may delete or rename an entry. That is exactly why users can write new files yet cannot remove each other's files, matching the reported behavior in /srv/dropbox.

Why this answer

Mode 1777 on a directory combines world read/write/execute with the sticky bit. Write plus execute lets every user create entries, while the sticky bit limits deletion and renaming to the entry's owner, the directory's owner, or root. This is the classic shared drop-box pattern used by /tmp, balancing open creation with protection of existing files.

Exam trap

The trap here is believing the sticky bit blocks writing into a directory, when it actually only restricts deleting or renaming entries already inside it.

4
MCQmedium

You have a file 'notes.txt' and you want to ensure the group owner can read and write it, but nobody else can access it. Which chmod command works?

A.chmod 060 notes.txt
B.chmod 666 notes.txt
C.chmod 660 notes.txt
D.chmod 770 notes.txt
AnswerC

660 is rw-rw----.

Why this answer

chmod 660 notes.txt sets the permissions to rw-rw----, meaning the owner and group both have read and write access, while others have no permissions at all. This matches the requirement that the group owner can read and write and nobody else can access the file. The leading 6 (rw-) applies to owner, the second 6 (rw-) to group, and the 0 (---) to others.

Exam trap

The trap here is confusing the octal digit order — candidates often swap owner and group positions or forget that the third digit controls 'others', leading them to pick 060 or 770 instead of 660.

How to eliminate wrong answers

Option A (chmod 060) is wrong because it gives the owner no permissions at all (0), the group read/write (6), and others none — the owner would be locked out of their own file. Option B (chmod 666) is wrong because it grants read and write to everyone (owner, group, and others), violating the 'nobody else can access it' requirement. Option D (chmod 770) is wrong because it grants full rwx to both owner and group and no access to others, but the question only requires read and write for the group, not execute, and 770 also gives the owner execute permission unnecessarily.

5
MCQmedium

A junior administrator runs `chmod 4755 /usr/local/bin/maintenance.sh` on a shared production server. Later, a standard user executes the script and it performs actions that the user would not normally be permitted to do. Which statement explains this behavior?

A.The script is automatically executed with the privileges of the user who last modified it.
B.The script runs with the effective user ID of the file owner, which is root in this case.
C.The script inherits the group ownership of the directory in which it resides, granting elevated access.
D.The fourth digit enables the sticky bit, which allows any user to override file ownership checks.
AnswerB

The leading 4 in 4755 sets the SUID bit on the executable. When a standard user runs it, the process's effective UID becomes that of the file's owner, not the invoking user. Since the owner is root, the script gains root's privileges for the duration of its execution, which is exactly why the actions succeeded.

Why this answer

A leading 4 in a numeric mode sets the SUID bit on an executable. When run, the process takes on the effective user ID of the file's owner rather than the caller's. With root as owner, the script runs with root privileges, which explains why a standard user could perform restricted actions.

Exam trap

The trap here is confusing the leading 4 with the sticky bit or with SGID, when it specifically sets SUID on the file.

6
Multi-Selectmedium

Which THREE commands can be used to check user information or current session identity?

Select 3 answers
A.userdel
B.chage
C.whoami
D.id
E.groups
AnswersC, D, E

`whoami` prints the effective username tied to the current process's security context, resolving it from the token rather than the login session. This satisfies the stem's requirement to check current session identity, and works non-interactively in scripts where `who` would instead list all logged-in users.

Why this answer

Option C, whoami, is correct because it prints the effective username of the current session, directly answering the question of current session identity. Option D, id, is correct because it displays the current user's UID, GID, and all supplementary group memberships, giving a complete picture of the session's identity. Option E, groups, is correct because it lists the groups the current user (or a specified user) belongs to, which is user information relevant to session identity.

Option A, userdel, is not correct because it is an administrative command that deletes a user account and does not report identity. Option B, chage, is not correct because it manages password aging information for a user account rather than reporting current session identity.

Exam trap

The trap here is confusing account management commands (userdel, chage) with commands that query user identity, as both involve user-related operations but serve different purposes.

7
MCQeasy

A system administrator needs to identify the numerical ID (UID) of the user 'jdoe'. Which file should be checked?

A./etc/shadow
B./etc/profile
C./etc/passwd
D./etc/group
AnswerC

The /etc/passwd file stores one colon-separated record per account, and its third field holds the numeric UID. Reading it directly reveals jdoe's UID, satisfying the requirement to identify the numerical identifier rather than a username or group ID.

Why this answer

The /etc/passwd file stores one line per user account, with colon-separated fields where the third field is the numerical UID. Checking this file (or running getent passwd jdoe) reveals the UID assigned to 'jdoe'. It is world-readable, unlike /etc/shadow, so it is the standard place to look up account identifiers.

Exam trap

The trap is confusing /etc/passwd with /etc/shadow — candidates remember that shadow holds 'password info' and wrongly assume it also holds the UID, but the UID lives in the world-readable passwd file.

How to eliminate wrong answers

Option A (/etc/shadow) is wrong because it stores hashed passwords and password-aging data, not UIDs, and is readable only by root. Option B (/etc/profile) is wrong because it is a shell initialization script that sets environment variables and PATH for login shells, containing no user account data. Option D (/etc/group) is wrong because it maps group names to GIDs and lists group members, not the UID of individual users.

8
MCQmedium

An auditor asks how to confirm which groups the currently logged-in user belongs to, including supplementary groups, from a shell prompt. Which single command displays this information for the invoking user?

A.newgrp
B.groupmod
C.groups
D.chgrp
AnswerC

Invoked without arguments, the groups command prints the group names associated with the current effective user, covering both the primary group and any supplementary groups. That directly answers the auditor's request to verify the logged-in user's group memberships from a shell prompt in one step.

Why this answer

The groups command, run without arguments, reports the group set for the current effective user, including the primary group and supplementary groups. That makes it the correct single command for confirming the invoking user's memberships during an audit, without needing to inspect /etc/group manually.

Exam trap

The trap here is reaching for groupmod, which edits group definitions, instead of groups, which simply reports the caller's memberships.

9
MCQeasy

A technician must create a new local account named 'intern' on a Linux workstation and wants the command to also create the home directory and skeleton files automatically. Which command accomplishes this with a single invocation on a typical distribution?

A.useradd -m intern
B.passwd -m intern
C.usermod -m intern
D.groupadd -m intern
AnswerA

The useradd command creates the account, and the -m flag instructs it to create the home directory and populate it from /etc/skel. On most distributions this is the direct, single-command way to add a user with a usable home directory, satisfying the requirement without a separate mkdir or copy step.

Why this answer

The useradd utility provisions a new account entry in /etc/passwd and /etc/shadow, and the -m option additionally creates the home directory, copying default files from /etc/skel. It is the standard single-step method for adding a local user with an immediately usable environment, which is precisely what the scenario requires.

Exam trap

The trap here is confusing usermod, which alters existing accounts, with useradd, which creates new ones.

10
MCQmedium

A server hosts a directory /srv/dropbox that many users write into. The administrator wants every new file created inside it to automatically belong to the group 'projects' rather than each creator's primary group, without changing anyone's account settings. Which action achieves this?

A.Run chgrp projects /srv/dropbox and rely on the default umask for inheritance.
B.Add every user to the projects group and set their primary group with newgrp.
C.Run chmod g+s /srv/dropbox so new entries inherit the directory's group.
D.Run chmod u+s /srv/dropbox so new entries inherit the directory's owner.
AnswerC

Setting the setgid bit on a directory makes the kernel assign that directory's group to every file and subdirectory created within it. Because /srv/dropbox is group-owned by projects, all new entries inherit projects automatically, and the setgid bit is also propagated to new subdirectories. No per-user account change is needed, which matches the requirement exactly.

Why this answer

The setgid bit on a directory is the standard Linux mechanism for group inheritance: files and subdirectories created inside take the directory's group, and the bit is copied to new subdirectories. Setting it on a directory already group-owned by projects satisfies the requirement without editing /etc/passwd or /etc/group for individual users.

Exam trap

The trap here is confusing the setuid bit with the setgid bit, since both appear as an s in ls output but only setgid governs directory group inheritance.

11
MCQeasy

What is the primary purpose of the /etc/shadow file?

A.It stores all user login shells.
B.It stores system-wide cron jobs.
C.It stores user group membership lists.
D.It stores encrypted password hashes.
AnswerD

The /etc/shadow file stores password hashes separately from /etc/passwd, which remains world-readable. This separation restricts hash access to root, satisfying the security constraint that ordinary users must not read password hashes. Hashes are salted and hashed, not merely "encrypted", though the option's intent matches the file's core purpose.

Why this answer

The /etc/shadow file stores encrypted password hashes along with password aging information for local user accounts. It is readable only by root, unlike /etc/passwd, which is world-readable and historically held the hashes.

Exam trap

The trap is confusing /etc/passwd (which holds user account info like UID, GID, home, and shell) with /etc/shadow (which holds the actual password hashes) — candidates who remember 'passwd has passwords' pick the wrong file.

How to eliminate wrong answers

Option A is wrong because login shells are stored in /etc/passwd (the seventh field), not /etc/shadow. Option B is wrong because system-wide cron jobs live in /etc/crontab and /etc/cron.d/, not /etc/shadow. Option C is wrong because group membership is stored in /etc/group (and /etc/gshadow for group passwords), not /etc/shadow.

12
MCQmedium

A developer runs `ls -l report.txt` and sees `-rw-r----- 1 alice devs 2048 May 10 09:15 report.txt`. The file must be readable by all members of the `devs` group, but currently only alice can read it. The file's group ownership is already correct. Which command will grant read access to the `devs` group without changing any other permission bits?

A.chmod g+r report.txt
B.chmod +r report.txt
C.chmod o+r report.txt
D.chmod u+r report.txt
AnswerA

This adds the read bit to the group permission set using symbolic mode. The g selects the group category, +r adds read, and all other bits (owner rw, others none) remain untouched. The file already belongs to the devs group, so group members gain read access exactly as required, and no execute or write permissions are introduced.

Why this answer

Symbolic chmod lets you manipulate one permission category at a time. Because group ownership is already correct and only the group read bit is missing, selecting the group category and adding read yields exactly the intended access. The other forms either target the wrong category or widen access to all users, which the scenario explicitly does not want.

Exam trap

The trap here is assuming a bare +r affects only the group, when it actually applies to owner, group, and others.

13
MCQhard

A security auditor wants to give a contractor temporary read-only access to a single log file /var/log/app/audit.log without adding the contractor to any group and without granting access to the rest of the directory. Which approach best matches least-privilege practice?

A.Use setfacl to add a read ACL entry for the contractor on the file only.
B.Change the file's group to a new group containing only the contractor and set the mode to 640.
C.Set the file mode to 644 so any user on the system can read it.
D.Run chmod o+r /var/log/app and rely on directory execute permission to limit access.
AnswerA

POSIX ACLs let you grant permissions to a named user on one file, independent of the traditional owner/group/others triads. A read ACL entry for the contractor gives exactly the required access to the single log while leaving the directory and other files untouched, which is the least-privilege outcome. It also avoids changing group membership.

Why this answer

POSIX ACLs express per-user and per-group permissions on individual files, which is precisely what the scenario needs: read access for one named contractor on one log file. The traditional mode bits cannot represent a single extra user without widening the group or others categories, so setfacl is the least-privilege tool.

Exam trap

The trap here is reaching for group changes or world-readable modes when a per-user ACL expresses the requirement without broadening access.

14
MCQmedium

Which command removes a group named 'tempgroup' from the system?

A.groupdel tempgroup
B.usermod -r tempgroup
C.grouprm tempgroup
D.removegroup tempgroup
AnswerA

`groupdel tempgroup` directly deletes the group entry from `/etc/group`, satisfying the requirement to remove the group from the system. Unlike `gpasswd -d`, which only removes a member, or `usermod`, which modifies membership, `groupdel` eliminates the group itself. It fails only if the group is a user's primary group.

Why this answer

The groupdel command is the standard Linux utility used to remove a group from the system. It deletes the group entry from /etc/group and /etc/gshadow, and is the correct tool for this task.

Exam trap

The trap is confusing usermod options with group management commands, or inventing non-existent commands like grouprm or removegroup.

How to eliminate wrong answers

Option B is wrong because usermod -r is not a valid option for removing groups; usermod modifies user accounts, and -r is used with useradd to create a system account, not to delete groups. Option C is wrong because grouprm is not a standard Linux command. Option D is wrong because removegroup is not a standard Linux command.

15
MCQhard

You notice a file has permissions listed as '-rwsr-xr-x'. What does the 's' in the owner's position indicate?

A.The file is a setgid binary.
B.The file is a setuid binary.
C.The file is immutable.
D.The file is a sticky directory.
AnswerB

The 's' in the owner's execute position denotes setuid: when executed, the process runs with the file owner's effective UID rather than the invoking user's. This satisfies the stem's '-rwsr-xr-x' string, where the owner's execute bit is replaced by 's' to signal that privilege elevation.

Why this answer

The 's' in the owner's execute position (the fourth character of the permission string) indicates the setuid bit is set. When a setuid binary is executed, the process runs with the effective UID of the file's owner rather than the invoking user, which is how tools like /usr/bin/passwd let ordinary users modify /etc/shadow. The lowercase 's' means the underlying execute bit is also set; an uppercase 'S' would mean setuid is set but execute is not.

Exam trap

The trap here is confusing the position of the special permission bits: candidates often assume any 's' means setgid, forgetting that setuid lives in the owner field, setgid in the group field, and sticky as 't' in the other field.

How to eliminate wrong answers

Option A is wrong because setgid would appear as an 's' in the group's execute position (the seventh character), not the owner's position. Option C is wrong because immutability is an extended attribute (chattr +i) and does not appear in the standard rwx permission string at all. Option D is wrong because the sticky bit appears as a 't' in the other/world execute position (the tenth character), typically on shared directories like /tmp.

16
MCQeasy

You are the administrator of a shared Linux workstation. A new employee needs to be added to the existing group 'research' so they can access group-owned project files. Which command accomplishes this?

A.groupmod -a newemployee research
B.useradd -G research newemployee
C.usermod -aG research newemployee
D.chgrp research newemployee
AnswerC

The usermod command modifies an existing user account. The -aG options append the user to the supplementary group 'research' without removing them from other groups. This is the correct and standard way to add a user to an additional group while preserving existing memberships.

Why this answer

To add an existing user to an additional group, use usermod with the -aG options. The -a flag ensures the user is appended rather than replacing all current supplementary groups, and -G specifies the target group. This grants the needed access without disrupting other memberships.

Exam trap

The trap here is using useradd or groupmod for an existing account, when the correct tool for modifying group membership is usermod with -aG.

17
MCQmedium

You are configuring a temporary directory where multiple users save files. To ensure that users can only delete their own files and not files created by others, what must you set?

A.chown root /tmp/shared
B.chmod 777 /tmp/shared
C.umask 077
D.chmod +t /tmp/shared
AnswerD

The sticky bit on a directory restricts deletion and renaming to each file's owner, the directory owner, or root. Setting chmod +t on the shared directory enforces exactly the constraint that users cannot delete others' files.

Why this answer

The sticky bit (chmod +t) on a shared directory ensures that only the file's owner (or root) can delete or rename files within it, even if the directory is world-writable. This is exactly the behaviour needed for /tmp-style shared drop boxes where multiple users write files but must not remove each other's data. The kernel enforces this by checking the file owner against the deleting user before permitting unlink or rename.

Exam trap

The trap is assuming that world-writable (777) permissions alone provide safe multi-user sharing; candidates forget that 777 actually enables cross-user deletion, and only the sticky bit restricts it.

How to eliminate wrong answers

Option A is wrong because chown root /tmp/shared only changes directory ownership to root; it does not restrict who can delete files inside, so any user with write permission could still remove others' files. Option B is wrong because chmod 777 grants full read/write/execute to everyone, which actually makes the problem worse — any user can delete any file. Option C is wrong because umask 077 only affects the default permission mask for newly created files by the current shell; it does not retroactively protect an existing shared directory or prevent cross-user deletion.

18
MCQhard

An administrator creates a directory `/srv/dropbox` with mode 1777 so that several contractors can deposit files. Later, one contractor reports that a file they uploaded vanished, and `ls -l /srv/dropbox` shows the directory still has its sticky bit set. Which statement best explains the situation?

A.The sticky bit prevents deletion only by non-owners, so the file's owner or the directory owner could still remove it.
B.Files in a sticky directory are moved to a hidden trash folder when the session ends.
C.The sticky bit only takes effect when the directory is also setgid, so it had no protective effect here.
D.The sticky bit was cleared by the upload and the directory now behaves as a normal world-writable directory.
AnswerA

On a directory, the sticky bit restricts deletion so that only the file's owner, the directory's owner, or root may unlink an entry. A contractor who owns the removed file, or the administrator who owns the directory, can legitimately delete it. The sticky bit therefore does not guarantee permanence; it only blocks unrelated users from removing other people's files.

Why this answer

The sticky bit on a directory limits deletion to the file's owner, the directory's owner, and root. Because contractors own their uploaded files and the administrator owns the directory, either could have unlinked the missing entry through normal means. The bit was never a guarantee against removal by those parties, so the disappearance is consistent with the directory's configured behavior.

Exam trap

The trap here is treating the sticky bit as absolute protection against deletion, when it merely excludes users who neither own the file nor the directory.

19
Multi-Selecthard

Which TWO of the following locations or methods are commonly used to define where a user's home directory is located?

Select 2 answers
A.The useradd -d flag
B./etc/passwd file
C.The /etc/profile file
D.The /etc/group file
E.The /etc/shadow file
AnswersA, B

The useradd -d flag explicitly sets the home directory path at account creation, overriding the default /home/username convention. It writes that value into the new user's /etc/passwd entry, satisfying the requirement to define the location.

Why this answer

Option A (the useradd -d flag) is correct because useradd -d /path/to/home explicitly sets the home directory field (field 6) for the new account when the user is created, writing that value into the account database. Option B (/etc/passwd file) is correct because the passwd file stores the home directory as the sixth colon-separated field of each user entry, and this is the authoritative location from which login programs read the user's home directory. Option C (/etc/profile) is not correct because it is a shell startup script that sets environment variables and login behavior, not the home directory definition.

Option D (/etc/group) is not correct because it defines group membership, not user home directories. Option E (/etc/shadow) is not correct because it stores password hashes and aging information, not the home directory path.

Exam trap

The trap is confusing files that store user metadata (/etc/passwd) with files that configure shell environment (/etc/profile) or group/password data (/etc/group, /etc/shadow).

20
MCQmedium

A junior administrator runs `chmod g+s /srv/reports` on a directory that is owned by root:finance and then creates a file inside it as the user `alice`, who is a member of the finance group. Which ownership will the newly created file have?

A.root:finance, because the directory owner's group is inherited and the owner is root
B.alice:root, because the file inherits the group of the parent process's effective user
C.alice:alice, because the creating user's primary group is always used
D.alice:finance, because SGID on a directory forces group inheritance from the directory
AnswerD

Setting the SGID bit on a directory makes every file and subdirectory created inside it inherit the directory's group instead of the creator's primary group. Since alice creates the file in /srv/reports, which is owned by root:finance, the file becomes alice:finance. This is exactly the behaviour chmod g+s is used to achieve for shared project directories.

Why this answer

The SGID bit on a directory changes group inheritance: files and subdirectories created within it receive the directory's group rather than the creator's primary group. Because /srv/reports is owned by root:finance, alice's new file is recorded as alice:finance. This is the standard mechanism for keeping shared project directories consistently group-owned so that all members of finance retain access.

Exam trap

The trap here is confusing the SGID bit on a directory, which controls group inheritance, with the SGID bit on an executable, which controls the effective group ID during execution.

21
MCQeasy

A user named bob has a primary group of users and is also a member of the group auditors. He creates a new file called notes.txt in his home directory. The system's default umask is 022. Which command would change the group ownership of notes.txt to auditors without altering its permissions?

A.chmod g+auditors notes.txt
B.usermod -g auditors notes.txt
C.chown auditors notes.txt
D.chgrp auditors notes.txt
AnswerD

chgrp changes the group ownership of a file. Since bob is a member of the auditors group, he can change the group of his own file to auditors, provided the file's permissions allow it. This command does not modify the mode bits, so the existing permissions remain intact, which matches the requirement exactly.

Why this answer

To change only the group ownership of a file, the correct tool is chgrp. Because bob is a member of the auditors group, he has the necessary privilege to assign that group to his own file. The chgrp command leaves all permission bits untouched, satisfying the requirement to change group ownership without altering permissions.

Exam trap

The trap here is confusing chown and chgrp, or assuming that chmod can assign a group name, when only chgrp or chown with a colon can change group ownership.

22
MCQhard

A user runs `umask` and sees `0022`. They create a new regular file with `touch report.txt`. Which permissions will the new file most likely have, and why?

A.-rw-------, because the umask removes all group and other access on files.
B.-rw-rw-r--, because the umask is added to the base mode rather than subtracted.
C.-rwxr-xr-x, because the umask is subtracted from a base of 777 for all new objects.
D.-rw-r--r--, because the umask is subtracted from a base of 666 for regular files.
AnswerD

Regular files are created without execute permission, so the starting mode is 666. Clearing the bits set in umask 022 removes group and other write, leaving 644, displayed as rw-r--r--. This matches the observed behavior for touch and most file-creating programs that do not request a different mode.

Why this answer

For regular files, the requested creation mode is 666 because the kernel withholds execute bits from the base; the umask is then used to clear the corresponding bits. With umask 0022, group and other write are cleared, yielding 644, which ls shows as rw-r--r--. Directories differ because their base is 777, which is why the same umask produces rwxr-xr-x on a new directory.

Exam trap

The trap here is assuming the umask is subtracted arithmetically from 777 for every object, when regular files actually start from 666 and directories from 777.

23
MCQmedium

To add a new user named 'guest' and set their home directory to '/home/guest', which command is correct?

A.useradd -m -d /home/guest guest
B.usermod -d /home/guest guest
C.useradd -h /home/guest guest
D.addhome guest
AnswerA

The `-m` flag creates the home directory, while `-d /home/guest` explicitly sets its path, satisfying the requirement to both add the user and define the home directory in one command. Without `-m`, `useradd` would not create the directory, leaving the specified path absent.

Why this answer

useradd -m -d /home/guest guest creates the account 'guest', sets its home directory to /home/guest via -d, and -m ensures the directory is actually created and populated with skeleton files from /etc/skel. Without -m, useradd would record the home path but not create it.

Exam trap

The trap is the -d versus -m distinction: candidates assume specifying -d is enough to create the home directory, but on RHEL-based systems you must also pass -m or the directory will not exist.

How to eliminate wrong answers

Option B (usermod -d /home/guest guest) is wrong because usermod modifies an existing account; it cannot create the 'guest' user, and without -m it will not create the directory either. Option C (useradd -h /home/guest guest) is wrong because useradd has no -h option for home directory — -h is not a valid flag (it would be rejected), and the correct flag is -d. Option D (addhome guest) is wrong because no such standard command exists; it is a fabricated distractor.

24
MCQmedium

A file named payroll.csv has permissions -rw-r-----. The user owner is carol, and the group owner is hr. A user named dave, who is not carol and not a member of hr, attempts to read the file. What will happen?

A.Dave will be granted read access because the owner has read permission and all users inherit owner permissions.
B.Dave will be denied access because the file is not world-readable, regardless of group membership.
C.Dave will be granted read access because the group has read permission and he is a regular user.
D.Dave will be denied access because he falls into the 'others' category, which has no read permission.
AnswerD

The permission string -rw-r----- indicates that the owner has read and write, the group has read only, and others have no permissions. Since dave is neither the owner nor a member of the hr group, he is classified as 'others'. The absence of any permission bits for others means the kernel will deny his read attempt with a permission denied error.

Why this answer

Linux evaluates file permissions by checking the most specific category that applies to the user: owner first, then group, then others. Dave is not the owner and not in the hr group, so he falls into the others category, which has no permissions. Consequently, the kernel denies his read request, and he receives a permission denied error.

Exam trap

The trap here is assuming that group permissions apply to all users, when in fact they apply only to users who are members of the file's group.

25
MCQmedium

A user reports that a script at /usr/local/bin/backup.sh runs with the permissions of the file's owner rather than the user who invoked it, and that this behaviour is intentional for a scheduled task. Which permission bit is responsible for this behaviour?

A.The setgid bit on the script, shown as an s in the group execute position.
B.The setuid bit on the script, shown as an s in the owner execute position.
C.The sticky bit on the script, shown as a t in the others execute position.
D.The execute bit for others combined with a umask of 022.
AnswerB

When setuid is set on an executable, the process runs with the effective UID of the file's owner rather than the invoking user. This is the classic mechanism that lets a program act with elevated privilege for a specific task. The scenario describes exactly that elevation, and the bit is displayed as an s where the owner's execute permission normally appears.

Why this answer

The setuid bit, set on an executable, makes the kernel run the resulting process with the effective UID of the file's owner. That is the only permission bit among the choices that changes the user identity of a running program. It is displayed as an s in the owner execute position of ls output.

Exam trap

The trap here is treating setgid and setuid as interchangeable, when only setuid changes the effective user identity of the process.

26
Multi-Selectmedium

Which TWO of these tools can modify file ownership or permissions?

Select 2 answers
A.groupdel
B.useradd
C.chown
D.usermod
E.chmod
AnswersC, E

chown changes a file's owning user and/or group, directly satisfying the stem's requirement to modify ownership. It cannot alter permission bits, so it complements chmod rather than replacing it. Together they cover the two distinct metadata axes the question asks about.

Why this answer

chown (C) is correct because it directly changes the owner and/or group of files and directories, e.g. chown user:group file. chmod (E) is correct because it modifies file permission bits (read/write/execute for user, group, and others) using symbolic or octal modes. groupdel (A) only removes a group from the system and does not alter file ownership or permissions. useradd (B) creates new user accounts and does not touch existing files' ownership or permissions. usermod (D) modifies user account attributes such as group membership or shell, but it does not change file ownership or permissions.

Exam trap

The trap here is confusing user account management commands (useradd, usermod, groupdel) with file attribute modification commands (chown, chmod). Candidates might think that usermod can change file ownership because it modifies user properties, but it does not.

27
MCQhard

You want to change the owner of 'data.txt' from 'user1' to 'user2' AND the group from 'group1' to 'group2' in one command. Which is correct?

A.chown user2 -g group2 data.txt
B.chown user2 group2 data.txt
C.chown user2:group2 data.txt
D.chown user2 data.txt && chgrp group2 data.txt
AnswerC

`chown` accepts a combined owner and group specification separated by a colon, so `user2:group2` changes both attributes in a single invocation. This satisfies the stem's requirement to alter owner and group simultaneously, unlike `chgrp`, which only reassigns group ownership and cannot modify the file's owner.

Why this answer

The chown command accepts the syntax 'chown user:group file' to change both owner and group in a single invocation. Using the colon as a separator between user and group is the canonical POSIX form, and chown also accepts a dot (chown user.group file) on most Linux systems. Option C is the only choice that correctly combines both changes into one valid command.

Exam trap

The trap here is confusing chown's syntax with chgrp's -g flag or assuming chown takes two positional arguments like 'chown user group file' — the exam tests whether you know the colon/dot delimiter is mandatory.

How to eliminate wrong answers

Option A is wrong because chown does not support a '-g' flag; that flag belongs to chgrp, not chown, so the command would fail with an invalid option error. Option B is wrong because passing two bare arguments to chown is interpreted as 'chown user file' with 'group2' treated as a second filename, not as a group — chown requires a colon or dot to delimit the group. Option D is wrong because it uses two separate commands joined by &&, which changes ownership and group sequentially rather than in one command as the question requires, and it is less efficient than the single chown invocation.

28
MCQmedium

A junior administrator is troubleshooting a payroll application and runs 'ls -l /srv/payroll/run.sh'. The output shows '-rwxr-x--- 1 root finance 2048 Apr 10 09:14 /srv/payroll/run.sh'. A member of the 'marketing' group complains the script fails with 'Permission denied'. What is the most likely reason?

A.The script lacks the setuid bit, so it cannot run with root privileges and the kernel refuses execution for non-owners.
B.The marketing user is not the file owner and is not a member of the finance group, so the 'others' permission set applies and grants no access.
C.The 'others' class has write permission removed, and Linux requires write access on a file before it can be executed by a non-owner.
D.The execute bit is missing from the group class, so even finance members cannot run the script and the shell falls back to the others class.
AnswerB

The permission string ends in '---', which is the others class. Since the marketing user is neither root nor in the finance group, Linux evaluates the others class, which has no read, write, or execute bits set. Any attempt to run the script is denied before the kernel even parses the interpreter, so the observed error is expected behavior for this ownership and mode combination.

Why this answer

Linux evaluates exactly one permission class per access: owner if the caller's UID matches, otherwise group if any of the caller's groups matches the file's group, otherwise others. A marketing user matches neither owner nor group, so only the trailing '---' applies, producing the denial. Understanding this single-class evaluation is essential when diagnosing access complaints.

Exam trap

The trap here is assuming Linux combines owner, group, and others permissions, when in reality only the single class matching the caller is ever consulted.

29
MCQeasy

A developer wants a shell script named `deploy.sh` located in the current directory to be runnable by typing `./deploy.sh`, but currently the command returns 'Permission denied' even though the file contains valid commands. Which command resolves the problem?

A.sudo ./deploy.sh
B.chown root deploy.sh
C.chmod 644 deploy.sh
D.chmod u+x deploy.sh
AnswerD

The execute bit is what allows the kernel to run a file as a program. Granting the owner execute permission with chmod u+x makes ./deploy.sh runnable for the account that owns it, which matches the developer's situation. Read and write bits alone do not permit execution, so adding the execute bit is precisely the missing step.

Why this answer

Executing a file with ./ requires that the file carry execute permission for the invoking user, and chmod u+x grants exactly that to the owner. The other choices either set a mode without any execute bit, change ownership without adding execute, or attempt to elevate privileges around the missing bit. Only adding execute permission addresses the reported error directly.

Exam trap

The trap here is reaching for sudo to work around 'Permission denied' when the real cause is simply a missing execute bit on the file.

30
MCQmedium

You want to change the primary group of an existing user named 'bob' to 'staff'. Which command should you use?

A.groupmod -n staff bob
B.chgrp staff bob
C.usermod -g staff bob
D.usermod -G staff bob
AnswerC

`usermod -g staff bob` sets bob's primary group, satisfying the requirement to change an existing user's primary group. The lowercase `-g` flag specifically assigns the primary group, whereas uppercase `-G` would only add supplementary groups, leaving the primary group unchanged.

Why this answer

The usermod command modifies existing user account attributes, and the -g flag specifically sets the user's primary group (the GID stored in /etc/passwd). Running 'usermod -g staff bob' changes bob's primary group to staff while leaving his supplementary group memberships intact. This is the standard, correct way to reassign a primary group on a Linux system.

Exam trap

The trap here is confusing usermod's -g (primary group) with -G (supplementary groups), and confusing usermod with groupmod or chgrp — candidates often pick -G thinking it 'adds' the group when it actually replaces the supplementary list.

How to eliminate wrong answers

Option A is wrong because 'groupmod -n staff bob' renames a group (the -n flag changes the group name), not a user's primary group, and would attempt to rename group 'bob' to 'staff'. Option B is wrong because chgrp changes the group ownership of a file or directory, not a user's primary group membership. Option D is wrong because 'usermod -G staff bob' sets the supplementary (secondary) group list, not the primary group, and would actually replace bob's existing supplementary groups with just 'staff'.

31
MCQeasy

Which directory contains the user accounts' password hashes and aging data on most modern Linux systems?

A./etc/shadow
B./etc/passwd
C./var/spool/mail
D./etc/group
AnswerA

On modern Linux systems, /etc/shadow holds the password hashes plus ageing fields such as last-change day and expiry, readable only by root. /etc/passwd retains the placeholder x in its password field, so it no longer carries hashes.

Why this answer

On modern Linux systems, /etc/shadow is the file that stores encrypted password hashes along with password aging information such as the last change date, minimum and maximum password age, and expiration warnings. It is readable only by root, which protects the hashes from unauthorized access. The /etc/passwd file historically held password hashes but now contains only user account information, with the password field replaced by an 'x' that points to /etc/shadow.

Exam trap

The trap here is the common misconception that /etc/passwd still stores password hashes, which was true in early Unix systems but is no longer the case on modern Linux due to security enhancements.

How to eliminate wrong answers

Option B is wrong because /etc/passwd no longer stores password hashes on modern systems; it contains user account details like UID, GID, home directory, and shell, with the password field typically showing 'x' to indicate the hash is in /etc/shadow. Option C is wrong because /var/spool/mail is the directory for user mailboxes, not password or aging data. Option D is wrong because /etc/group defines group memberships and does not contain password hashes or aging information for user accounts.

32
MCQhard

A contractor needs to run a diagnostic script that requires reading a log file owned by `root` with mode `640` and group `adm`. The contractor's account `contractor` has primary group `contractor` but has been added as a supplementary member of `adm`. Which statement describes what will happen when the contractor attempts to read the file?

A.The read fails because the file is owned by root and the others class has no read permission.
B.The read succeeds because supplementary group membership is honored, and the group read bit applies to the adm group.
C.The read fails because only the primary group is considered when evaluating the group permission class.
D.The read succeeds only if the contractor first runs newgrp adm to switch the primary group for the session.
AnswerB

Linux evaluates a process's group set, which includes the primary group plus all supplementary groups. Since contractor is a supplementary member of adm and the file grants read to its group adm, the access check passes. The owner class does not apply, and the others class has no read bit, but the group class matches.

Why this answer

Permission evaluation walks the owner, group, and others classes in order and stops at the first match. Because the contractor is a supplementary member of adm and the file grants read to group adm, the group class applies and access is allowed. Primary group switching or owner identity considerations do not change the outcome in this setup.

Exam trap

The trap here is believing that only the primary group counts for the group permission class, when supplementary memberships are equally valid.

33
MCQeasy

A user wants to view the permissions of all files in a directory, including hidden files, in a long listing format. Which command should they use?

A.ls -l
B.ls -lh
C.ls -la
D.ls -a
AnswerC

The command ls -la combines the -l (long format) and -a (all files) options, providing a detailed listing that includes permissions, ownership, size, and modification time for all files, including hidden ones. This is the correct command to view permissions of all files in a directory, including hidden files, in a long listing format.

Why this answer

To view permissions of all files, including hidden ones, in a long listing format, the ls command needs both the -l and -a options. The -l option provides detailed information such as permissions, ownership, and size, while -a ensures that hidden files (those starting with a dot) are included. Combining them as ls -la achieves the desired output.

Exam trap

The trap here is forgetting that hidden files are not shown by default and that the -a option is required in addition to -l to see them.

34
MCQeasy

A junior administrator needs to change the ownership of the file `/var/www/html/index.html` from user `deploy` to user `www-data`, while leaving the group ownership and all permission bits exactly as they are. Which command should be used?

A.chgrp www-data /var/www/html/index.html
B.chown www-data:www-data /var/www/html/index.html
C.chown www-data /var/www/html/index.html
D.chmod www-data /var/www/html/index.html
AnswerC

When chown is given a single name without a colon or dot, that name is interpreted as the new owner and the group is left unchanged. Permission bits are also untouched. This matches the requirement precisely: only the owning user changes to www-data, with group ownership and mode preserved.

Why this answer

The chown command changes file ownership, and when only a user name is supplied, the group is preserved. Using the colon form would change both owner and group, violating the requirement. The chmod and chgrp commands address permissions and group ownership respectively, so neither can fulfill the stated ownership change.

Exam trap

The trap here is treating chown and chgrp as interchangeable, when only chown can change the owning user and only the colon form alters the group.

35
MCQhard

You are managing a directory shared by a project team. You want all files created in this directory to automatically belong to the 'developers' group, regardless of the user's primary group. Which command achieves this?

A.usermod -aG developers
B.chgrp developers /data
C.chmod g+s /data
D.chmod 1777 /data
AnswerC

chmod g+s sets the setgid bit on the directory, so newly created files inherit the directory's group (developers) rather than the creator's primary group. This satisfies the stem's requirement that all files automatically belong to the developers group regardless of the user's primary group.

Why this answer

`chmod g+s /data` sets the setgid (SGID) bit on the directory. When SGID is set on a directory, any file or subdirectory created inside inherits the directory's group ownership instead of the creating user's primary group. This is exactly the behavior needed for a shared 'developers' group directory.

Exam trap

The trap is confusing SGID on a directory (group inheritance for new files) with SGID on an executable (run with the file's group privileges) — candidates pick `chgrp` thinking changing the directory's group is enough.

How to eliminate wrong answers

Option A is wrong because `usermod -aG developers` adds a user to the developers supplementary group — it changes group membership but does not affect the group ownership of newly created files in /data. Option B is wrong because `chgrp developers /data` changes the group owner of the directory itself but does not propagate that group to files created inside it. Option D is wrong because `chmod 1777 /data` sets the sticky bit (like /tmp) with world-writable permissions, which prevents users from deleting others' files but does not enforce group inheritance.

36
MCQmedium

A developer runs `mkdir /srv/collab` on an ext4 filesystem, then runs `chmod 2775 /srv/collab` so that the directory is owned by root:devteam. Later, a member of the devteam group creates a file inside /srv/collab with their default umask of 022. Which group will own the newly created file?

A.No group, because the file is created without a group until chgrp is run explicitly.
B.The root group, because the parent directory is owned by root:devteam and ownership is copied.
C.The devteam group, because the setgid bit on the parent directory forces group inheritance.
D.The creating user's primary group, because file group ownership always mirrors the creator.
AnswerC

The setgid bit on a directory causes new files and subdirectories to inherit the directory's group (devteam) rather than the creator's primary group. This is precisely why the developer set mode 2775. The umask affects the permission bits, not the group ownership, so the file will be owned by the creating user but grouped under devteam.

Why this answer

The setgid bit on a directory makes new entries inherit the directory's group instead of the creator's primary group. Because the directory was set to 2775 with group devteam, any file created inside will belong to devteam while retaining the creator as user owner. The umask only strips permission bits and does not change group ownership.

Exam trap

The trap here is assuming that a file's group always comes from its creator, which ignores how the setgid bit changes group inheritance on directories.

37
Multi-Selectmedium

Which THREE commands are related to viewing or changing group memberships?

Select 3 answers
A.groups
B.chgrp
C.id
D.groupmod
E.usermod -aG
AnswersA, C, E

The `groups` command lists every group a user belongs to, directly satisfying the requirement to view group memberships. It reads the supplementary group IDs from the current process, printing names without needing elevated privileges. This makes it the definitive viewing command among the three, complementing `usermod` and `groupmod` for changes.

Why this answer

Option A, `groups`, is correct because it displays the groups a specified user (or the current user) belongs to, directly showing group memberships. Option C, `id`, is correct because it prints the user's UID, primary GID, and the list of supplementary groups the user is a member of, which is exactly membership information. Option E, `usermod -aG`, is correct because the `-aG` combination appends the user to one or more supplementary groups, thereby changing group memberships without removing existing ones.

Option B, `chgrp`, is not correct here because it changes the group ownership of files or directories, not a user's group membership. Option D, `groupmod`, is not correct because it modifies a group's attributes such as its name or GID, rather than viewing or changing which users belong to groups.

Exam trap

The trap is including groupmod or chgrp because they contain 'group' in the name — candidates must distinguish commands that manage group objects/files from those that manage a user's group membership.

38
MCQhard

You want to set a default umask of 027 for all users. Which file should you edit to apply this globally?

A./etc/bashrc
B./etc/passwd
C.~/.bash_profile
D./etc/profile
AnswerD

Editing /etc/profile sets the umask for login shells across all users, satisfying the global default requirement. However, it only applies to Bourne-compatible login shells, so non-login shells or other shells may not inherit it; /etc/login.defs or /etc/bashrc often supplement this.

Why this answer

The /etc/profile file is a system-wide initialization script executed by login shells for all users. Placing a umask 027 command there sets the default umask globally, affecting every user who starts a login shell. This is the standard location for system-wide environment and shell settings on Linux distributions that use the Bourne-compatible shell family.

Exam trap

The trap here is confusing per-user shell configuration files (like ~/.bash_profile) with system-wide configuration files, or mistakenly thinking that /etc/passwd controls shell behavior, when it only stores account information.

How to eliminate wrong answers

Option A is wrong because /etc/bashrc is not a standard system-wide configuration file on most Linux distributions; the equivalent is usually /etc/bash.bashrc or /etc/bashrc on some systems, but it is shell-specific and not the primary global profile. Option B is wrong because /etc/passwd stores user account information (username, UID, GID, home directory, shell) and does not control shell initialization or umask settings. Option C is wrong because ~/.bash_profile is a per-user file, so editing it would only affect the user who owns that home directory, not all users globally.

39
MCQmedium

You need to create a new group named 'audit'. Which command should you execute?

A.newgroup audit
B.groupadd audit
C.useradd -g audit
D.addgroup audit
AnswerB

`groupadd audit` directly creates the group in `/etc/group`, satisfying the requirement for a new group named 'audit'. Unlike `usermod` or `gpasswd`, which modify existing groups, `groupadd` is the dedicated Linux utility for group creation, so it fulfils the stem's constraint without additional flags.

Why this answer

The `groupadd` command is the standard Linux utility for creating a new group, and `groupadd audit` will create a group named 'audit' in the system's group database (/etc/group). This is part of the shadow-utils package and is the canonical way to add groups on Linux distributions.

Exam trap

The trap here is confusing group creation with user creation or with Debian-specific wrappers — candidates who use Ubuntu daily may reflexively pick `addgroup`, but the LPI exam expects the portable, canonical `groupadd`.

How to eliminate wrong answers

Option A is wrong because `newgroup` is not a standard Linux command (it resembles the macOS/BSD `dseditgroup` or HP-UX `groupadd` variants, but does not exist on Linux). Option C is wrong because `useradd -g audit` creates a new user and assigns them to an existing group named 'audit'; it does not create the group itself. Option D is wrong because `addgroup` is a Debian/Ubuntu convenience script (part of the adduser package) that is not universally available and is not the canonical command tested on Linux Professional Institute exams.

40
MCQeasy

Which permission bit must be set on a directory to allow a user to enter the directory and access files within it?

A.Write (w)
B.Execute (x)
C.Sticky bit
D.Read (r)
AnswerB

Execute (x) permission on a directory grants traverse rights, letting a user pass through it and reach files inside. Without it, path resolution fails even if the files themselves are readable, so x satisfies the stem's requirement to enter the directory and access its contents.

Why this answer

The execute (x) bit on a directory grants the right to traverse it — that is, to access files and subdirectories by name within it. Without x, even if you have read permission, you cannot cd into the directory or open files whose paths pass through it.

Exam trap

The trap is assuming read permission is sufficient to access files in a directory — candidates pick 'Read (r)' because it sounds like the permission needed to 'see' files, but traversal specifically requires execute (x).

How to eliminate wrong answers

Option A is wrong because write (w) on a directory allows creating, deleting, and renaming entries within it, but does not by itself permit traversal or access to existing files. Option C is wrong because the sticky bit (t) on a directory restricts deletion of files to their owners (used on /tmp); it does not grant traversal. Option D is wrong because read (r) on a directory only allows listing the directory's entries (e.g., via ls), not entering it or accessing files inside.

41
Multi-Selecteasy

Which TWO of the following are true about the 'others' category of file permissions?

Select 2 answers
A.Only root can modify this category.
B.Is the last set of characters in the 'ls -l' output.
C.Automatically inherits group permissions.
D.Can override owner permissions.
E.Represents all users not the owner and not in the group.
AnswersB, E

In ls -l output, permissions appear as three character triplets: owner, group, then others. The final triplet governs users who are neither the file's owner nor members of its group, so it is indeed the last set of characters displayed.

Why this answer

Option B is correct because in the ten-character permission string produced by 'ls -l' (e.g., -rwxr-xr-x), the final three characters represent the permissions for the 'others' category, following the owner and group triplets. Option E is correct because 'others' is defined as every user account that is neither the file's owner nor a member of the file's owning group, so those users are governed by this third permission set. Option A is wrong because any user who falls into the 'others' category is affected by these bits, and the owner or root can change them via chmod; it is not restricted to root.

Option C is wrong because 'others' permissions are set independently and do not inherit from group permissions. Option D is wrong because owner permissions take precedence in the kernel's permission-checking order (owner, then group, then others), so 'others' can never override the owner's bits.

Exam trap

The trap is believing permission categories inherit or override each other — candidates may pick 'automatically inherits group permissions' or 'can override owner permissions,' but the three triads are independent and evaluated in strict owner→group→others order.

42
Multi-Selecthard

Which THREE of the following are special permission bits in Linux?

Select 3 answers
A.Immutable bit
B.Sticky bit
C.Append-only bit
D.Setgid
E.Setuid
AnswersB, D, E

The sticky bit is a special permission bit, set on directories to restrict deletion so only a file's owner, the directory owner, or root may remove or rename entries within it. This satisfies the question's requirement for special permission bits, alongside setuid and setgid, distinguishing it from standard read, write, and execute permissions.

Why this answer

The sticky bit (B) is a special permission bit, historically used on directories so that only a file's owner (or root) can delete or rename files within it, and it appears as a 't' in the other-execute position of ls -l output. Setgid (D) is a special permission bit that, when set on an executable, runs it with the file's group identity, and when set on a directory causes new files to inherit the directory's group; it is shown as 's' in the group-execute position. Setuid (E) is a special permission bit that makes an executable run with the file owner's effective UID, displayed as 's' in the user-execute position.

By contrast, the immutable bit (A) and append-only bit (C) are file attributes managed by chattr and viewed with lsattr (e.g., chattr +i and chattr +a), not permission bits set via chmod, so they are not among the three special permission bits.

Exam trap

The trap is conflating filesystem attributes (immutable, append-only, managed by chattr/lsattr) with permission bits (setuid, setgid, sticky, managed by chmod) — the exam deliberately mixes them to test whether you know the difference between inode attributes and mode bits.

43
Multi-Selectmedium

A security audit requires reviewing which local accounts exist on a Linux server, which of them have usable login shells, and which groups each account belongs to. Which TWO commands or files provide authoritative local account and group membership information? (Choose two.)

Select 2 answers
A./etc/shadow
B./etc/passwd
C./etc/skel
D./etc/group
E./etc/nsswitch.conf
AnswersB, D

This file stores one line per local account with fields for username, UID, primary GID, home directory, and login shell. Auditors can read it to enumerate accounts and identify those with interactive shells versus system accounts using /usr/sbin/nologin or /bin/false. It is the canonical source for local user account information.

Why this answer

Local account records live in /etc/passwd, and local group definitions with supplementary members live in /etc/group. Reading them together reveals which accounts exist, what login shells they have, and which groups each belongs to. The shadow file covers passwords, skel provides templates, and nsswitch merely directs lookup order, so those three do not supply the required listings.

Exam trap

The trap here is reaching for /etc/shadow as the account database, when it actually stores password aging data and is unreadable to non-root auditors.

44
MCQhard

A user complains they cannot read a file. The file has permissions 640 and is owned by root, but the user is in the group that owns the file. Why can't they read it?

A.The umask is set to 077.
B.The user lacks execute permission on a parent directory.
C.The user is not the owner.
D.The file is locked by root.
AnswerB

Reading a file requires execute (search) permission on every parent directory in its path. Without execute permission on a parent directory, the user cannot traverse into it to reach the file, so read access on the file itself is irrelevant.

Why this answer

On Linux, reading a file requires execute (x) permission on every directory in the path leading to the file. Even though the file's group permissions include read (the '4' in 640), the user cannot traverse into the directory containing the file without execute permission on that parent directory. This is the classic 'permission denied' scenario where file permissions look correct but directory traversal is blocked.

Exam trap

The trap here is focusing only on the file's own permission bits (640) and forgetting that directory execute permission is a prerequisite for any file access — a concept the LPI 010-160 exam frequently tests.

How to eliminate wrong answers

Option A is wrong because umask affects the default permissions of newly created files and directories; it does not retroactively change existing file permissions and is irrelevant to why an already-created 640 file cannot be read. Option C is wrong because the user is in the group that owns the file, so the group permission bits (the '4' in 640) apply to them — ownership is not the issue. Option D is wrong because Linux does not have a 'file lock by root' concept that prevents reads; root can read any file, and file locking (flock/fcntl) is advisory and does not produce permission-denied errors.

45
Multi-Selecteasy

Which THREE of these are valid types of permissions in Linux file systems?

Select 3 answers
A.Read
B.Execute
C.Write
D.Delete
E.Append
AnswersA, B, C

Read permission lets a user open and view a file's contents, and list a directory's entries. It satisfies the stem's requirement for a valid Linux file-system permission type, forming one of the three standard permission bits (read, write, execute) applied to owner, group and others.

Why this answer

In Linux file systems, the standard permission model defines exactly three basic permission types: read (r), write (w), and execute (x), so options A (Read), B (Execute), and C (Write) are all correct. Read allows viewing file contents or listing a directory, write allows modifying file contents or creating/deleting entries within a directory, and execute allows running a file as a program or traversing a directory. These three permissions are represented in the rwx notation and in octal values (4, 2, 1) used by chmod.

Option D (Delete) is not a distinct permission type; deletion is governed by write and execute permissions on the containing directory. Option E (Append) is also not a separate permission type in the standard Linux model; append-only behavior is enforced through file attributes such as chattr +a, not through the rwx permission bits.

Exam trap

The trap is that 'delete' and 'append' feel like natural file operations, so candidates assume they must be permission types — but Linux only defines read, write, and execute bits.

46
MCQhard

What is the result of running 'chmod 000 secret.txt'?

A.The file becomes read-only for root.
B.No user can access it (except root).
C.Only the owner can access it.
D.The file is deleted.
AnswerB

Setting all permission bits to zero removes read, write and execute access for owner, group and others, satisfying the stem's requirement that the file becomes inaccessible. Root bypasses these discretionary checks via CAP_DAC_OVERRIDE, so the parenthetical exception holds. Ordinary users, including the owner, are denied until permissions are restored.

Why this answer

chmod 000 removes all permission bits (read, write, execute) for owner, group, and others, so no regular user can read, write, or execute the file. Root bypasses discretionary permission checks on most filesystems, so root can still access it. This is why the correct answer is that no user can access it except root.

Exam trap

The trap here is assuming the owner always retains access to their own file, but chmod 000 removes owner permissions too, and root's special bypass is the only exception.

How to eliminate wrong answers

Option A is wrong because 000 does not make the file read-only for root; root retains full access regardless of permission bits, and read-only would be a different mode such as 444. Option C is wrong because 000 removes owner permissions too, so the owner cannot access it either (unless they are root). Option D is wrong because chmod only changes permission bits; it never deletes a file, and deletion requires rm or unlink.

47
MCQeasy

A junior administrator needs to let a colleague in the accounting group read and write the shared report at /srv/reports/q3.csv, but no one outside that group should have any access. The file is currently owned by the administrator. Which command accomplishes this by changing only the group ownership to 'accounting'?

A.chmod g=accounting /srv/reports/q3.csv
B.chgrp accounting /srv/reports/q3.csv
C.usermod -g accounting /srv/reports/q3.csv
D.chown accounting /srv/reports/q3.csv
AnswerB

chgrp changes only the group owner of a file, leaving the user owner and the permission bits untouched. Pointing it at the accounting group makes the file's group category apply to accounting members, so a later chmod g+rw grants them read and write while others remain excluded. This is exactly the minimal, targeted change the scenario requires.

Why this answer

Group ownership is stored as a numeric GID in the file's inode and is changed with chgrp, or equivalently with chown using a colon separator. Using chgrp accounting changes only that metadata field, so the subsequent permission bits for the group category will apply to accounting members. Tools that edit user accounts or that only touch mode bits cannot perform this change.

Exam trap

The trap here is assuming chown with a bare name sets the group, when a single name is always treated as the new user owner.

48
Multi-Selecthard

Which TWO statements regarding the 'umask' command are correct?

Select 2 answers
A.It can only be set by root.
B.It sets default permissions for new files.
C.It is stored in /etc/shadow.
D.It applies to existing files immediately.
E.It masks bits from being set on new files.
AnswersB, E

umask defines the permission bits withheld when a process creates files, so it establishes the default permissions applied to newly created files. This satisfies the stem's requirement by describing its effect on file creation defaults.

Why this answer

Option B is correct because umask defines the default permission bits that are removed when a new file or directory is created, so it directly sets the default permissions for new files (e.g., a umask of 022 yields 644 for files and 755 for directories). Option E is correct because umask works by masking, or clearing, permission bits from the base creation mode (666 for files, 777 for directories) so those bits are not set on newly created files. Option A is wrong because any user can set their own umask, not just root.

Option C is wrong because umask is a shell/process attribute typically set in shell profiles like /etc/profile or ~/.bashrc, not stored in /etc/shadow, which holds password hashes. Option D is wrong because umask only affects files created after it is set; it does not retroactively change permissions on existing files.

Exam trap

The 010-160 exam often tests whether candidates think umask changes existing files or is root-only, when in fact it only affects new files and can be set by any user.

49
MCQeasy

Which command-line tool is used to display the groups a specific user belongs to?

A.groups
B.id
C.listgroups
D.whoami
AnswerA

The `groups` command queries the system's group database and prints every group name associated with a specified user, directly satisfying the requirement to display a user's group memberships. Unlike `id`, which also reports the numeric UID and GID, `groups` outputs only group names, matching the question's specific scope.

Why this answer

The groups command prints the group memberships for a specified user (or the current user if none is given), making it the direct answer. Running 'groups alice' lists every group alice belongs to, including her primary group and any supplementary groups. It reads from /etc/group and /etc/passwd (or NSS sources like LDAP/SSSD) to resolve memberships.

Exam trap

The trap is that id also displays group information, so candidates may pick it; the exam distinguishes the purpose-built groups command from the more general id utility.

How to eliminate wrong answers

Option B is wrong because while id also shows group memberships (via 'id -Gn' or the groups= line), the question asks for the tool specifically used to display groups, and groups is the canonical, purpose-built command. Option C is wrong because listgroups is not a standard Linux command. Option D is wrong because whoami only prints the effective username of the current user and says nothing about group membership.

50
MCQhard

You want to delete a user account named 'baduser' and also remove their home directory. Which command is correct?

A.deluser --remove baduser
B.userdel -f baduser
C.userdel -r baduser
D.rm -rf /home/baduser && userdel baduser
AnswerC

The -r flag tells userdel to remove the user's home directory and mail spool alongside the account itself. This satisfies the stem's requirement to delete baduser and also remove their home directory in one command.

Why this answer

The userdel -r command removes the user account from /etc/passwd and /etc/shadow and also deletes the user's home directory and mail spool in one step. This is the standard, atomic way to fully decommission an account on Linux. Using -r ensures no orphaned home directory remains, which is important for security and disk hygiene.

Exam trap

The trap is confusing the force flag (-f) with home-directory removal (-r); candidates often pick -f thinking it cleans up everything, when it only forces deletion of the account itself.

How to eliminate wrong answers

Option A is wrong because deluser --remove is not a valid Debian syntax for removing the home directory; the correct Debian option is --remove-home (or --remove-all-files), so this command would fail or behave unexpectedly. Option B is wrong because userdel -f forces deletion even if the user is still logged in or has running processes, but it does not remove the home directory — it only removes the account entry. Option D is wrong because manually running rm -rf /home/baduser before userdel is redundant and risky; userdel -r already handles home directory removal safely, and the manual rm could delete the wrong path if the home directory is non-standard.

51
MCQhard

A system administrator creates a shared directory /srv/collab and sets its permissions to 1777. Users report that they can create files but cannot delete files created by other users. Which statement describes the effect of the leading 1 in the permission mode?

A.It sets the SGID bit, causing new files to inherit the directory's group ownership.
B.It enables mandatory locking, preventing users from deleting files while they are open by another process.
C.It sets the SUID bit, allowing any user to execute files in the directory with the directory owner's privileges.
D.It sets the sticky bit, which restricts deletion of files in the directory to the file owner, the directory owner, or root.
AnswerD

The leading 1 in 1777 sets the sticky bit on the directory. On a world-writable directory, this prevents users from deleting or renaming files they do not own. Only the file owner, the directory owner, or root can remove files. This matches the reported behavior exactly.

Why this answer

The leading 1 in a numeric mode sets the sticky bit on a directory. When applied to a world-writable directory, it restricts deletion and renaming of files to the file owner, the directory owner, or root. This is exactly why users can create files but cannot delete files owned by others.

Exam trap

The trap here is confusing the sticky bit with SGID or SUID, when the leading 1 specifically sets the sticky bit on the directory.

52
MCQeasy

Which file permission represents read, write, and execute for the owner, and read-only for group and others?

A.755
B.644
C.700
D.744
AnswerD

Permission 744 grants the owner read, write and execute (7), while group and others receive read only (4 each). This satisfies the stem's requirement of full owner access alongside read-only access for group and others, matching the octal digit positions for user, group and other respectively.

Why this answer

The permission 744 means the owner has read (4), write (2), and execute (1) = 7, while group and others each have read (4) only. This matches the requirement of read, write, and execute for the owner and read-only for group and others. The other options do not match this exact combination.

Exam trap

010-160 often tests whether candidates confuse the octal values for read, write, and execute, so the trap is miscomputing 744 as including execute for group/others or selecting 755 which adds execute for everyone.

How to eliminate wrong answers

Option A is wrong because 755 gives the owner 7 (rwx) but group and others get 5 (r-x), which includes execute, not read-only. Option B is wrong because 644 gives the owner 6 (rw-) without execute, and group/others 4 (r--). Option C is wrong because 700 gives the owner 7 (rwx) but group and others get 0 (no permissions), not read-only.

53
MCQhard

A user's account has been compromised. Which command is the most effective way to lock the user account immediately while preserving their files?

A.usermod -L jdoe
B.userdel jdoe
C.killall -u jdoe
D.chsh -s /bin/false jdoe
AnswerA

usermod -L prefixes the password hash with an exclamation mark in /etc/shadow, immediately disabling password logins while leaving the account's home directory and files untouched. This locks access without deleting data, unlike userdel, which would remove the account and its files.

Why this answer

`usermod -L jdoe` locks the account by prepending an exclamation mark (!) to the password hash in /etc/shadow, immediately preventing password-based logins while leaving the user's home directory, files, UID, and group memberships fully intact. This is the standard, reversible administrative action for a compromised account because it disables authentication without destroying data or ownership.

Exam trap

The trap here is confusing 'disabling login' with 'deleting the account' — candidates often pick `userdel` because it sounds like the strongest action, but the question explicitly requires preserving the user's files.

How to eliminate wrong answers

Option B is wrong because `userdel jdoe` deletes the account and, depending on flags, may remove or orphan the user's home directory and files, which violates the requirement to preserve files. Option C is wrong because `killall -u jdoe` only terminates running processes owned by the user; it does not disable the account, so the user can log back in immediately. Option D is wrong because `chsh -s /bin/false jdoe` changes the login shell to a non-interactive binary, which blocks interactive shell logins but does not prevent other authentication methods (e.g., SSH with a forced command, cron jobs, or services) and does not lock the password.

54
MCQhard

A shared project directory `/srv/team` is owned by user `lead` and group `team`. Team members must be able to create, edit, and delete each other's files, and every new file must automatically belong to the `team` group even when created by a user whose primary group is something else. The directory already has permissions `drwxrwx---`. Which single action accomplishes the group inheritance requirement?

A.chmod g+rwx /srv/team
B.chmod g+s /srv/team
C.chmod +t /srv/team
D.chown :team /srv/team
AnswerB

Setting the setgid bit on a directory causes newly created files and subdirectories inside it to inherit the directory's group ownership rather than the creator's primary group. Since the directory's group is already team, all new content will belong to team. This directly satisfies the requirement without altering existing permissions or ownership.

Why this answer

The setgid bit on a directory is the standard mechanism for group inheritance. Once set, the kernel assigns the directory's group to every new file and subdirectory created within it, regardless of the creator's primary group. The sticky bit addresses deletion rights, and plain permission or ownership changes do not affect inheritance, so only the setgid approach meets the requirement.

Exam trap

The trap here is confusing the sticky bit's deletion protection with setgid's group inheritance, since both are special bits applied to directories.

55
MCQeasy

A file is owned by root and has permissions 600. What happens if a regular user tries to read this file?

A.The user is prompted for a password.
B.The user can only read but not write.
C.Access is granted.
D.Access is denied.
AnswerD

Permissions 600 grant read and write access solely to the owner, root, while group and others receive no permissions. A regular user falls into the "others" category, so the kernel denies the open() call with EACCES, satisfying the stem's constraint that the requester is not the owner.

Why this answer

With permissions 600 (rw-------), only the file owner (root) has read and write access; group and other have no permissions at all. A regular user falls into the 'other' category, so the kernel denies the read attempt with EACCES (Permission denied). This is standard POSIX discretionary access control behavior — the owner bits apply only to UID 0 in this case, and no ACL or capability overrides the denial.

Exam trap

The trap here is confusing the owner's permissions with everyone's permissions — candidates forget that 600 grants nothing to group or other, and that Linux does not prompt for credentials at the filesystem layer.

How to eliminate wrong answers

Option A is wrong because Linux does not prompt for a password on file access — that behavior belongs to sudo or su, not to the read() syscall, which simply returns EACCES. Option B is wrong because the user has no read permission at all; the 600 mode grants read/write only to the owner, and the user is not the owner. Option C is wrong because access is not granted — the 'other' permission bits are zero, so the kernel blocks the open() call before any data is read.

56
MCQhard

An administrator wants to allow a user named carol to read a file /etc/secure.conf that is owned by root:root with permissions 600, without changing the file's permissions or adding carol to the root group. Which command should the administrator use?

A.chmod 640 /etc/secure.conf
B.chown carol /etc/secure.conf
C.setfacl -m u:carol:r /etc/secure.conf
D.usermod -aG root carol
AnswerC

The setfacl command with -m u:carol:r adds an access control list entry granting carol read permission. This allows carol to read the file without altering the standard permissions or group membership. ACLs are the correct tool for granting per-user access beyond the traditional owner/group/others model.

Why this answer

Access Control Lists (ACLs) allow granting permissions to specific users or groups without modifying the standard owner/group/others permissions. The setfacl command adds an entry for carol with read access, leaving the file's mode and ownership intact. This is the appropriate method for such granular access requirements.

Exam trap

The trap here is thinking that changing the group or adding the user to a group is the only way, overlooking ACLs as a targeted solution.

57
Multi-Selectmedium

Which THREE commands are used to manage user account lifecycle?

Select 3 answers
A.passwd
B.groupadd
C.useradd
D.userdel
E.usermod
AnswersC, D, E

useradd creates a new account, writing the entry to /etc/passwd and /etc/shadow. It is the creation stage of the account lifecycle, complementing modification and deletion commands to cover the full span the question asks for.

Why this answer

The three commands that manage the user account lifecycle are useradd (C), userdel (D), and usermod (E). useradd creates a new user account, including its entry in /etc/passwd, /etc/shadow, and /etc/group, and optionally provisions a home directory and default shell, which is the creation phase of the lifecycle. userdel removes a user account and, with options like -r, also deletes the home directory and mail spool, covering the deletion phase. usermod modifies an existing account's attributes such as login name (-l), UID (-u), shell (-s), groups (-aG), and account expiry, covering the maintenance/modification phase. passwd (A) only changes or manages a user's password and password aging, and groupadd (B) only creates groups, so neither manages the full user account lifecycle of create, modify, and delete.

Exam trap

The trap is including passwd or groupadd because they 'feel' related to accounts — but the exam specifically wants the create/modify/delete trio, and passwd/groupadd do not perform lifecycle operations on user accounts.

58
Multi-Selectmedium

You are hardening a server and must ensure that ordinary users cannot read the contents of `/etc/shadow`. Which two statements about `/etc/shadow` access are correct? (Choose two.)

Select 2 answers
A.It is readable by all users because the passwd command must consult it during a normal login.
B.It can be read by any user who supplies the correct password through the sudo prompt.
C.Its contents are encrypted with a system-wide key stored in /etc/crypttab, so permissions are largely irrelevant.
D.Its permissions are typically 640 with owner root and group shadow, so only root and members of the shadow group can read it.
E.It stores password hashes in a format that ordinary users could crack offline if they could read the file.
AnswersD, E

The conventional mode for /etc/shadow is 640 owned by root:shadow, which allows root full access and members of the shadow group read access. Ordinary users fall into the others category, which has no permissions, so they cannot read the hashed passwords. This is the standard hardening expectation on most Linux distributions.

Why this answer

On typical Linux systems /etc/shadow is mode 640 with owner root and group shadow, leaving the others category with no access, which is what keeps ordinary users from reading password hashes. Those hashes are salted but still vulnerable to offline cracking if exposed, so read restriction is the key control. Direct reads happen through privileged programs, not through ordinary user access.

Exam trap

The trap here is assuming the login process requires world-readable access to /etc/shadow, when privileged helper programs perform the lookup on the user's behalf.

59
MCQhard

A developer stores a private SSH key at /home/dev/id_rsa and wants to remove all permissions for group and others while keeping full owner access, using octal notation. Which command achieves exactly this?

A.chmod 600 /home/dev/id_rsa
B.chmod 644 /home/dev/id_rsa
C.chmod 400 /home/dev/id_rsa
D.chmod 700 /home/dev/id_rsa
AnswerA

Octal 600 grants read and write to the owner and nothing to group or others, which is the required state for a private key and matches SSH's own expectations. It removes every group and others permission while preserving the owner's full read/write access, exactly as the developer requested.

Why this answer

Octal mode 600 sets rw- for the owner and --- for both group and others. That isolates the private key to its owner while keeping read and write access intact, satisfying the stated requirement and aligning with the restrictive permissions SSH expects for private key material.

Exam trap

The trap here is choosing 400 for a private key, forgetting that the owner then loses the write access the scenario explicitly requires.

60
MCQeasy

A user named alice has a primary group alice and is also a member of the group developers. She creates a new file named report.txt in her home directory. The umask is set to 022. What are the permissions of the newly created file?

A.-rw-------
B.-rw-r--r--
C.-rw-rw-r--
D.-rwxr-xr-x
AnswerB

With umask 022, the default creation mode for a regular file (666) has the write bits for group and others removed, resulting in 644, which is -rw-r--r--. The owner has read and write, group has read, and others have read. This is the standard behavior for a newly created file when the umask is 022 and the application does not specify a different mode.

Why this answer

When a regular file is created, the kernel starts with a base mode of 666 (rw-rw-rw-) and applies the umask by clearing the bits specified. Umask 022 clears the write bits for group and others, leaving 644 (rw-r--r--). Thus the new file report.txt will have read and write for the owner, and read-only for group and others.

Exam trap

The trap here is confusing the base mode for files (666) with that for directories (777), leading to incorrect calculation of the resulting permissions.

Ready to test yourself?

Try a timed practice session using only Security And File Permissions questions.