Courseiva

CCNA Security And File Permissions Questions

35 questions · Security And File Permissions topic · 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

This sets the immutable flag, preventing all modifications.

Why this answer

The chattr +i command sets the immutable attribute, which prevents any user, including root, from deleting, renaming, or modifying the file until the attribute is removed.

2
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

Owner: rwx (7) or rw (6), Group: rw (6), Others: none (0). 660 provides read/write for owner and group.

3
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

Shows current username.

Why this answer

id shows identity, whoami shows current user, and groups shows group memberships.

4
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

This file stores user account metadata.

Why this answer

The /etc/passwd file contains user account information, including the username, UID, GID, home directory, and shell.

5
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

Shadow files are used to hide sensitive password data.

Why this answer

/etc/shadow stores user password hashes and password aging information, keeping them separate from /etc/passwd for security.

6
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

Standard command for group removal.

Why this answer

The 'groupdel' command is the standard utility for removing groups from the system.

7
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 setuid bit allows elevation to the file owner's privileges.

Why this answer

The 's' in the owner's field indicates the setuid bit is set, meaning the file runs with the privileges of the file owner rather than the user running it.

8
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 prevents unauthorized file deletion.

Why this answer

The sticky bit (represented by the 't' in the others permission field) restricts file deletion to the owner of the file, the directory owner, or root.

9
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

Defines location at creation.

Why this answer

The home directory is set in /etc/passwd or during the useradd command via the -d flag.

10
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

-m creates the directory, -d specifies the path.

Why this answer

The 'useradd -m' flag creates the home directory, and the username is specified as the last argument.

11
Multi-Selecthard

Which TWO of the following characterize the 'root' user in Linux?

Select 2 answers
A.Cannot be restricted by file permissions.
B.Always has a UID of 0.
C.Cannot be locked.
D.Must have a shell set to /bin/bash.
E.Is always member of the 'users' group.
AnswersA, B

Root bypasses standard DAC permissions.

Why this answer

Root has a UID of 0 and has unrestricted access to the entire file system.

12
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

Modifies ownership.

Why this answer

chmod changes permissions, chown changes ownership.

13
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

This syntax handles both owner and group.

Why this answer

The chown command supports the syntax 'user:group' to change both owner and group simultaneously.

14
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

This changes the primary group.

Why this answer

The 'usermod -g' command is used to modify the primary group of an existing user account.

15
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

Contains encrypted hashes and aging.

Why this answer

The /etc/shadow file stores the password hashes and aging information securely.

16
Multi-Selecteasy

Which TWO of the following files are essential for basic user and group management?

Select 2 answers
A./etc/hosts
B./etc/group
C./etc/fstab
D./etc/passwd
E./etc/shadow
AnswersB, D

Contains group info.

Why this answer

/etc/passwd holds account information, and /etc/group holds group information.

17
MCQmedium

Which command would you use to change the expiration date of a user's password?

A.chage
B.passwd -e
C.usermod -e
D.userdel -p
AnswerA

chage manages password aging settings.

Why this answer

The 'chage' command is used to modify password aging information and expiration dates for user accounts.

18
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

The setgid bit on a directory forces group inheritance.

Why this answer

Setting the setgid bit (chmod g+s) on a directory ensures that new files created within inherit the group ownership of the directory.

19
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

Lists membership.

Why this answer

groups lists them, id shows them, and usermod -aG changes them.

20
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

Global login shell configuration.

Why this answer

/etc/profile is the system-wide configuration file executed for all users upon login, making it the appropriate place for global umask settings.

21
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

Standard command to create a group.

Why this answer

The 'groupadd' command is the standard utility for creating a new group in Linux.

22
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 grants directory traversal access.

Why this answer

The execute bit (x) on a directory allows a user to 'enter' or 'traverse' the directory to access its contents.

23
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

The last three bits (rwx) in rwxrwxrwx.

Why this answer

Others represent users who are neither the owner nor in the file's group, and they are the least privileged group.

24
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

Special bit for file deletion restriction.

Why this answer

Setuid, setgid, and the sticky bit are the three special permission bits.

25
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

To access any file, the user must have execute permissions on every parent directory in the path.

Why this answer

640 means (rw-r-----). The group has read permissions (r), so if they are in the group, they should have access. If they still cannot read, it might be due to a parent directory restriction.

26
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

Permission to view contents.

Why this answer

Read, Write, and Execute are the three primary file permissions.

27
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

000 blocks all access.

Why this answer

000 removes all permissions for owner, group, and others. The file is inaccessible to everyone except root.

28
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

Defines what permissions are removed.

Why this answer

Umask defines default permissions for new files and directories, and it acts as a mask by subtracting bits from the maximum possible permission.

29
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

Lists all groups for the user.

Why this answer

The 'groups' command lists all group memberships for a specified username.

30
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

-r flag performs the removal of home and mail files.

Why this answer

The '-r' flag with 'userdel' removes the user's home directory and mail spool.

31
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

744 is rwxr--r--.

Why this answer

7 (rwx) + 4 (r--) + 4 (r--) = 744.

32
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

Locks the password without removing user data.

Why this answer

The usermod -L command locks the password, preventing the user from logging in, while keeping the user's home directory and files intact.

33
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

The user lacks the required read permission.

Why this answer

Permission 600 (rw-------) allows only the owner (root) to read or write. A regular user (not root) will be denied access (Permission denied).

34
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

Creates user.

Why this answer

useradd creates, usermod changes, and userdel removes accounts.

35
MCQmedium

A user reports they cannot execute a script named 'deploy.sh' even though the file permissions are set to 644. What must you change to enable execution for the owner?

A.chmod 655 deploy.sh
B.chmod 744 deploy.sh
C.chown u+x deploy.sh
D.chmod +w deploy.sh
AnswerB

744 provides rwx for the user and r-- for group/others.

Why this answer

Permission 644 (rw-r--r--) lacks the execute bit. Changing the mode to 744 (rwxr--r--) adds execution rights for the owner.

Ready to test yourself?

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