Curated

Security

0 votes

Questions120

  1. Question 1

    Security

    What role does polkit play on a Linux system?

    Show the answer

    Correct answerA. It decides whether an unprivileged process may perform a privileged action, such as mounting a disk

    AWhy this is right: polkit is an authorization framework that allows, denies or asks for authentication for privileged actions.

    BWhy not this: Directory authentication is done by PAM with SSSD, LDAP or Kerberos; polkit only authorizes actions.

    CWhy not this: Mandatory access control labels are enforced by SELinux or AppArmor, not polkit.

    DWhy not this: Granting root shells from a rules file describes sudo and sudoers, not polkit.

    Polkit is an authorization framework: it evaluates rules to allow, deny or require authentication for privileged actions, such as a desktop user mounting a disk or managing a systemd unit. Directory-based authentication is handled by other services such as PAM with SSSD, LDAP or Kerberos.

    Open this question
  2. Question 2

    Security

    A company wants users to sign in once and then access multiple Linux services without re-entering a password. The design must use time-limited tickets issued by a central trusted authority rather than sending passwords to each service. Which service provides this function?

    Show the answer

    Correct answerB. Kerberos

    Kerberos uses a key distribution center to issue time-limited tickets, enabling single sign-on without sending passwords to each service. LDAP is tempting, but it is a directory protocol for storing and querying identity data; it does not issue tickets.

    Open this question
  3. Question 3

    Security

    A Linux administrator is joining several RHEL servers to an existing Active Directory domain. Users must log in with their domain credentials, and the servers must cache identities and credentials locally so logins still work if the domain controller is briefly unreachable. Which component should the administrator configure on each server to provide this identity lookup, authentication and offline caching?

    Show the answer

    Correct answerA. SSSD

    SSSD connects the system to remote identity and authentication providers such as AD, LDAP and Kerberos, and caches credentials for offline logins. Polkit is tempting but only decides whether an unprivileged process may perform privileged actions; it does not look up or authenticate domain users.

    Open this question
  4. Question 4

    Security

    The /var/log/journal directory on a server has grown large and is filling the disk. An administrator must immediately reduce the archived journal files to no more than 500 MB. Which command accomplishes this?

    Show the answer

    Correct answerD. journalctl --vacuum-size=500M

    --vacuum-size deletes the oldest archived journal files until total usage is at or below the given size. --rotate only archives the active journal files and starts new ones, so it does not remove anything and frees no space on its own.

    Open this question
  5. Question 5

    Security

    A systemd-based server rebooted overnight, and an administrator needs to review only the messages from the sshd service that were logged at error severity or higher since the current boot. Which command does this?

    Show the answer

    Correct answerA. journalctl -u sshd -p err -b

    -u limits output to the sshd unit, -p err shows error and more severe entries, and -b restricts it to the current boot. -k shows only kernel messages, so it would drop the sshd entries, while -x just adds explanatory text across all stored boots.

    Open this question
  6. Question 6

    Security

    An administrator is writing a logrotate configuration for /var/log/app/*.log. The logs must be rotated once per week, and exactly eight rotated copies must be kept before the oldest is removed. Which two directives meet these requirements? (Choose two.)

    Choose 2 answers

    Show the answer

    Correct answersA. rotate 8D. weekly

    weekly sets the time interval for rotation, and rotate 8 keeps eight rotated logs before deleting the oldest. compress only gzips rotated files and does not control how many are retained. size 8M triggers rotation by file size, not weekly.

    Open this question
  7. Question 7

    Security

    An administrator adds a file watch rule with auditctl and confirms it appears in auditctl -l. After the server reboots, the rule is gone. Which action makes the rule persistent?

    Show the answer

    Correct answerB. Place the rule in a file under /etc/audit/rules.d/ and run augenrules --load

    Persistent rules belong in a .rules file under /etc/audit/rules.d/, which augenrules merges into /etc/audit/audit.rules and loads at boot. Setting -e 1 only enables auditing for the running kernel and does not save rules. auditd.conf holds daemon settings, not rules.

    Open this question
  8. Question 8

    Security

    A security team requires a record of every write or attribute change to /etc/sudoers, tagged so the events can be found later with ausearch. Which command adds a rule that meets this requirement?

    Show the answer

    Correct answerD. auditctl -w /etc/sudoers -p wa -k sudoers_change

    A watch rule (-w) with permissions w and a logs writes and attribute changes, and -k sets the search key for ausearch -k. The -p rx variant watches reads and executes, not modifications. -W removes a watch, and -a expects a list and action rather than a path.

    Open this question
  9. Question 9

    Security

    The https service was allowed in the public zone with a runtime-only command, and the rule works. The rule must still be in effect after the server reboots. Which two commands achieve this? (Choose two.)

    Choose 2 answers

    Show the answer

    Correct answersA. firewall-cmd --permanent --zone=public --add-service=httpsB. firewall-cmd --runtime-to-permanent

    --runtime-to-permanent copies the running configuration to disk, and --permanent --add-service writes the rule directly to the permanent configuration, which is loaded at boot. Re-running --add-service without --permanent only changes the runtime state again, and --reload discards runtime-only rules.

    Open this question
  10. Question 10

    Security

    A web application listens on TCP port 8080 on the local host. Clients connecting through the public zone use port 80, so incoming TCP port 80 traffic must be forwarded to port 8080 on the same host. Which command adds this rule to the public zone's runtime configuration?

    Show the answer

    Correct answerB. firewall-cmd --zone=public --add-forward-port=port=80:proto=tcp:toport=8080

    --add-forward-port takes the incoming port in port= and the destination port in toport=. The reversed version would send port 8080 traffic to port 80, and toaddr expects an IP address, not a port. --add-port only opens a port and has no port-mapping syntax.

    Open this question
  11. Question 11

    Security

    An administrator added several ports and a rich rule to the running firewalld configuration and confirmed that the application works. The changes must now be saved permanently without retyping each one. Which command does this?

    Show the answer

    Correct answerA. firewall-cmd --runtime-to-permanent

    firewall-cmd --runtime-to-permanent writes the current runtime configuration to the permanent configuration. --reload does the opposite: it loads the permanent configuration and discards the runtime-only changes, so the tested rules would be lost.

    Open this question
  12. Question 12

    Security

    A server's management interface is assigned to the internal zone, and its public-facing interface is in the public zone. A monitoring agent listens on TCP port 8443, and that port must be reachable only through the internal zone. Which command adds the rule to the running configuration correctly?

    Show the answer

    Correct answerD. firewall-cmd --zone=internal --add-port=8443/tcp

    The --zone option targets internal, and --add-port needs the port/protocol format. Omitting --zone applies the rule to the default zone, which is often public and so exposes the port on the wrong interface. A bare port number without a protocol is rejected, and --add-service takes a service name, not a port.

    Open this question
  13. Question 13

    Security

    The ssh service has been removed from the public zone on a server. Administrators on the 192.168.10.0/24 network must still be able to connect over SSH, and no other source should gain SSH access. Which command adds the correct rule to the public zone's runtime configuration?

    Show the answer

    Correct answerC. firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.10.0/24" service name="ssh" accept'

    A rich rule with the source address of the admin network, the ssh service and the accept action permits only that network. The drop version would block the admins, and a destination address matches traffic sent to that network rather than traffic coming from it. A port element also needs a protocol, so that rule is invalid.

    Open this question
  14. Question 14

    Security

    An administrator moves sshd on an Ubuntu server to listen on TCP port 2222. The firewall has the rule created earlier by running "sudo ufw allow ssh", and ufw is active with a default deny incoming policy. Remote clients now time out when they connect to port 2222. Which command BEST allows the connections?

    Show the answer

    Correct answerA. sudo ufw allow 2222/tcp

    The service name "ssh" resolves to port 22/tcp, so the existing rule never covers the new port. Allowing 2222/tcp opens the port sshd actually uses. Limiting ssh is tempting, but it still resolves to port 22 and only adds rate limiting.

    Open this question
  15. Question 15

    Security

    A web server has the rule "ufw allow 443/tcp" as rule number 1 of its ruleset. The administrator then runs "sudo ufw deny from 203.0.113.50 to any port 443 proto tcp", but that host can still reach HTTPS. Which action BEST blocks that host while leaving access open to everyone else?

    Show the answer

    Correct answerC. Run sudo ufw insert 1 deny from 203.0.113.50 to any port 443 proto tcp

    ufw evaluates rules in order and the first match wins, so the deny added at the end never takes effect behind the general allow. Inserting it at position 1 places it first. Setting default deny incoming does not help, because an explicit allow rule already overrides the default policy.

    Open this question
  16. Question 16

    Security

    A server runs a legacy application that accepts TCP connections on every port from 6000 through 6007. Which ufw command opens exactly these ports and no UDP ports?

    Show the answer

    Correct answerB. sudo ufw allow 6000:6007/tcp

    ufw expresses a port range with a colon, and a range must name a protocol, here tcp. A hyphen is not valid range syntax. Omitting the protocol makes ufw reject the range, and the udp form opens the wrong protocol.

    Open this question
  17. Question 17

    Security

    An administrator has a ruleset saved with iptables-save in /etc/iptables.rules. The system is moving to nftables, and the administrator wants the existing rules converted to nftables syntax. Which command should be used?

    Show the answer

    Correct answerD. iptables-restore-translate -f /etc/iptables.rules

    iptables-restore-translate reads an iptables-save file and outputs equivalent nft commands. nft -f loads a file that is already in nft syntax, so it would fail on iptables-save format. ipset restore only handles ipset data.

    Open this question
  18. Question 18

    Security

    A server runs iptables. An administrator must drop traffic from about 50,000 known-bad IPv4 addresses without slowing packet processing or creating thousands of rules. Which approach BEST meets this need?

    Show the answer

    Correct answerA. Create a hash:ip ipset and add one iptables rule that uses -m set --match-set with the set as the source

    An ipset hash:ip set is looked up in near-constant time, and a single rule using the set match applies it. Thousands of individual rules are checked sequentially, which is what causes the slowdown. The -s option takes addresses or networks, not set names.

    Open this question
  19. Question 19

    Security

    A firewall must block traffic from 20,000 IP addresses on a blocklist that changes daily. Which iptables approach keeps the rule set small and fast?

    Show the answer

    Correct answerD. Load the addresses into an ipset set and match it with one rule

    AWhy not this: 20,000 rules are checked one by one, which is slow and hard to update daily.

    BWhy not this: iptables expands a comma-separated -s list into one rule per address, so the rule set stays large.

    CWhy not this: hosts.deny is read by TCP Wrappers-aware programs, not by iptables.

    DWhy this is right: One rule with -m set --match-set tests packets against the whole set, which can be updated without editing rules.

    ipset stores addresses in kernel sets, and one iptables rule using -m set --match-set can test a packet against the whole set. Listing each address as its own rule is the slower approach that ipset was built to replace.

    Open this question
  20. Question 20

    Security

    A junior administrator asks how packet filtering is structured on a Linux server. Which statements about Netfilter are accurate? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersA. It places hooks at fixed points in the kernel network stack where packets can be inspected, modified or dropped.C. Its connection tracking lets rules match packets by connection state, such as NEW or ESTABLISHED.D. The nft and iptables commands are user-space tools that load rules into the Netfilter framework in the kernel.

    AWhy this is right: Netfilter hooks such as PREROUTING, INPUT, FORWARD, OUTPUT and POSTROUTING sit at fixed points in the kernel stack.

    BWhy not this: Netfilter is in the kernel; rules take effect as soon as a tool loads them, with no daemon to start.

    CWhy this is right: The conntrack subsystem tracks connections, so rules can match states such as NEW or ESTABLISHED.

    DWhy this is right: nft and iptables run in user space and only load rules into the kernel framework.

    EWhy not this: Netfilter filters IPv6 too, through ip6tables or nftables ip6 and inet tables.

    FWhy not this: Loaded rules live in kernel memory and vanish at reboot unless saved, for example by nftables.service.

    Netfilter is the kernel framework: it provides hooks and connection tracking, and nft and iptables are only front-ends that configure it. It is not a daemon. Rules are enforced by the kernel as soon as they are loaded, with no service to start. It handles IPv6 as well as IPv4, and loaded rules live in kernel memory, so they must be saved to a file and restored at boot to survive a reboot.

    Open this question
  21. Question 21

    Security

    An administrator must redirect inbound TCP traffic for port 8080 to an internal server at 10.0.0.5 by rewriting the destination address. The change must happen before the kernel makes its routing decision. At which Netfilter hook should the rule be applied?

    Show the answer

    Correct answerD. prerouting

    Prerouting is evaluated before the routing decision, so destination NAT applied there changes where the packet is routed. Forward is tempting, but it runs after routing, so the destination would already have been decided and a rewrite there would be too late.

    Open this question
  22. Question 22

    Security

    A Linux router has IP forwarding enabled. A packet arrives on one interface, addressed to a host on a different network behind another interface. In which order does the packet pass through the Netfilter hooks?

    Show the answer

    Correct answerB. prerouting, forward, postrouting

    Forwarded traffic passes prerouting, then forward after the routing decision, then postrouting as it leaves. Input and output apply only to packets destined for, or generated by, the local host, so a path through input is the tempting but wrong choice.

    Open this question
  23. Question 23

    Security

    An ISP assigns a branch office one public IPv4 address. Two hundred internal hosts share it for outbound traffic, and the Linux router rewrites source ports when two hosts use the same source port, so replies can be matched to the right host. Which translation type is being used?

    Show the answer

    Correct answerA. Port Address Translation

    PAT (NAPT) maps many private hosts to one public address by tracking and rewriting source ports. Static one-to-one NAT is tempting, but it maps each private address to its own public address and needs no port tracking.

    Open this question
  24. Question 24

    Security

    A Linux gateway has the public address 203.0.113.5. Internet clients must reach TCP port 443 on this address and be served by a web server at 192.168.10.20 on the internal network. Which translation type should the administrator configure on the gateway?

    Show the answer

    Correct answerC. Destination NAT applied before routing

    DNAT rewrites the destination address of inbound packets in the nat table's PREROUTING chain, so they are forwarded to the internal host. REDIRECT is tempting, but it only sends traffic to a port on the local gateway, not to another host.

    Open this question
  25. Question 25

    Security

    A Linux router connects the 192.168.1.0/24 LAN to the internet through an interface whose public address is assigned by the ISP through DHCP and changes periodically. LAN clients need outbound access. Which translation type BEST fits?

    Show the answer

    Correct answerB. Source NAT using the MASQUERADE target

    MASQUERADE is source NAT that uses the outgoing interface's current address, so it keeps working when DHCP changes the address. Fixed-address SNAT is tempting, but it would break or need rewriting whenever the public address changes.

    Open this question
  26. Question 26

    Security

    A Linux host must accept replies to connections it starts while blocking new inbound connections. How does a stateful filter accept those replies?

    Show the answer

    Correct answerA. It matches the tracked connection state, such as ESTABLISHED

    AWhy this is right: Connection tracking remembers outbound connections, so one ESTABLISHED rule admits their replies.

    BWhy not this: Matching ports and flags on each packet is how a stateless filter has to handle replies.

    CWhy not this: Checking payloads is deep packet inspection; stateful filtering works from connection state.

    DWhy not this: conntrack matches replies automatically; no per-reply rule or approval is involved.

    Stateless filtering judges each packet alone on header fields, with no memory of earlier packets, so it must match replies by ports and flags. Stateful filtering uses connection tracking (conntrack), so one rule matching established state covers replies to connections the host initiated.

    Open this question
  27. Question 27

    Security

    A Linux server has an iptables INPUT chain with a default policy of DROP. The server starts outbound HTTPS connections to a package mirror, but the replies are being dropped. The administrator wants replies accepted without allowing unsolicited inbound packets to high-numbered ports. Which rule BEST meets this requirement?

    Show the answer

    Correct answerC. iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

    Matching ESTABLISHED,RELATED uses connection tracking (stateful), so only packets belonging to connections the host started are accepted. The source-port and ACK rule is stateless: it checks only header fields, so any crafted packet from port 443 with ACK set would also pass.

    Open this question
  28. Question 28

    Security

    A technician is turning a Linux server with two network interfaces into a router between two subnets. Hosts on both subnets can reach the server, but packets sent through it to the other subnet are dropped. The command 'sysctl net.ipv4.ip_forward' returns 0. Which action will enable forwarding immediately and keep it enabled after a reboot?

    Show the answer

    Correct answerD. Run 'sysctl -w net.ipv4.ip_forward=1' and add 'net.ipv4.ip_forward = 1' to a file in /etc/sysctl.d/

    Setting the value with sysctl -w changes the running kernel, and the entry in /etc/sysctl.d/ makes it persist at boot. Writing to /proc takes effect at once but is lost on reboot. Changing the iptables FORWARD policy does not turn on kernel forwarding.

    Open this question
  29. Question 29

    Security

    An administrator added 'net.ipv4.ip_forward = 1' to /etc/sysctl.d/99-router.conf on a gateway host. Running 'sysctl net.ipv4.ip_forward' still shows 0, and clients behind the gateway cannot reach the internet. The administrator wants the setting applied now, without a reboot, by loading all configured sysctl files. Which command should be run?

    Show the answer

    Correct answerD. sysctl --system

    The sysctl --system command reloads settings from all standard configuration directories, including /etc/sysctl.d/, and applies them to the running kernel. The sysctl -a command only lists current values and changes nothing. Restarting a target does not reliably reread sysctl files.

    Open this question
  30. Question 30

    Security

    A support user is allowed to run less on one log file as root through sudo. The security team worries the user could type !sh inside less and get an unrestricted root shell. Which sudoers entry BEST mitigates this?

    Show the answer

    Correct answerC. ops ALL=(root) NOEXEC: /usr/bin/less /var/log/app.log

    The NOEXEC tag stops the allowed program from running other commands, which blocks shell escapes from less. NOPASSWD only removes the password prompt, and denying one shell path is easily bypassed with other shells or binaries.

    Open this question
  31. Question 31

    Security

    An administrator runs su - with no username. What is the result?

    Show the answer

    Correct answerA. After root's password is entered, a root login shell starts with root's environment in root's home directory

    AWhy this is right: su - with no name targets root, asks for root's password and starts a login shell with root's environment.

    BWhy not this: su asks for the target user's password; using one's own password is how sudo works.

    CWhy not this: su prompts for root's password unless the caller is already root.

    DWhy not this: Keeping the caller's environment and directory is plain su without the hyphen.

    The hyphen makes su start a login shell for the target user, which defaults to root. That sets root's environment and home directory and requires root's password. Without the hyphen, much of the calling user's environment is kept.

    Open this question
  32. Question 32

    Security

    A junior administrator must let members of the webops group run only systemctl restart nginx as root. The rule must be syntax-checked before it takes effect so that a typo cannot break sudo for everyone. Which method is BEST?

    Show the answer

    Correct answerA. Run visudo -f /etc/sudoers.d/webops and add the rule there

    visudo locks the file and validates syntax before saving, and a drop-in under /etc/sudoers.d keeps the change separate from the main file. A plain editor skips the validation, so a typo can break sudo for all users.

    Open this question
  33. Question 33

    Security

    An administrator runs su root and finds the working directory is still their own home directory and PATH lacks /usr/sbin. Which command BEST gives a root shell with root's own environment, home directory and PATH?

    Show the answer

    Correct answerA. su - root

    su - starts a login shell, so root's profile, home directory and PATH are used. su -m and sudo -E deliberately preserve the calling user's environment, which is the opposite of what is needed. newgrp only changes the group.

    Open this question
  34. Question 34

    Security

    A cron job running as the deploy account must run /usr/local/bin/deploy.sh as root through sudo without a password prompt. Which sudoers entry follows least privilege?

    Show the answer

    Correct answerA. deploy ALL=(root) NOPASSWD: /usr/local/bin/deploy.sh

    Limiting NOPASSWD to one root-owned script gives the job only what it needs. A wildcard or ALL lets the account run arbitrary commands as root with no password, and !authenticate removes the prompt for every command.

    Open this question
  35. Question 35

    Security

    A security administrator wants to protect /etc/resolv.conf on a server so that no user, including root, can modify, delete, or rename the file until the protection is deliberately removed. Which command accomplishes this?

    Show the answer

    Correct answerA. chattr +i /etc/resolv.conf

    The immutable attribute (+i) blocks modification, deletion, renaming and linking of the file, even by root, until it is cleared with chattr -i. The append-only attribute (+a) is tempting but still permits data to be added to the file, so it does not fully lock it.

    Open this question
  36. Question 36

    Security

    An administrator suspects that root cannot edit a configuration file because it was made immutable with chattr. Which check confirms this?

    Show the answer

    Correct answerA. lsattr shows the letter i in the file's attribute list

    AWhy this is right: lsattr reports attributes set with chattr, and i marks the file immutable even to root.

    BWhy not this: The letter a marks append-only, which allows adding data, not full immutability.

    CWhy not this: A t in ls -l output is the sticky bit on directories, not the immutable attribute.

    DWhy not this: getfacl shows access control lists; immutability is a file attribute that ACLs do not show.

    lsattr lists ext-family file attributes, and the i flag marks a file as immutable, while a marks append-only. The attributes are set or cleared with chattr, not lsattr, which only reports them.

    Open this question
  37. Question 37

    Security

    An administrator must ensure that /var/log/audit-custom.log can only have new lines added by processes and cannot be truncated, edited in place, or deleted, while logging continues to work. Which command should be used?

    Show the answer

    Correct answerA. chattr +a /var/log/audit-custom.log

    The append-only attribute (+a) lets a file be opened only in append mode, so logging continues while truncation, overwriting and deletion are prevented. The immutable attribute (+i) is tempting but would block all writes, which would stop the logging.

    Open this question
  38. Question 38

    Security

    A hardening standard requires that files created by users default to mode 640 and new directories default to mode 750. Which umask value should be configured?

    Show the answer

    Correct answerC. 027

    A umask of 027 removes write from group and all access from others, producing 640 for files (666 base) and 750 for directories (777 base). Umask 037 is tempting because it also yields 640 files, but it produces 740 directories, which blocks group access.

    Open this question
  39. Question 39

    Security

    An administrator needs the ordinary file report.txt to end up with permissions rw-r----- regardless of its current mode. Which three commands achieve this? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersA. chmod u=rw,g=r,o-rwx report.txtC. chmod 640 report.txtE. chmod u=rw,g=r,o= report.txt

    Octal 640, explicit assignment with an empty others set, and assignment plus removing all others' bits each produce rw-r-----. Mode 604 is tempting because it uses the same digits, but it gives others read and the group nothing.

    Open this question
  40. Question 40

    Security

    The directory /srv/reports is already owned by the group analysts and has mode 770. Files created there by any member must automatically belong to analysts, regardless of the creator's primary group. Which command accomplishes this?

    Show the answer

    Correct answerC. chmod 2770 /srv/reports

    The setgid bit (leading 2) on a directory makes new files inherit the directory's group. The sticky bit (leading 1) is tempting, but it only restricts deletion and renaming to file owners and does not affect group inheritance.

    Open this question
  41. Question 41

    Security

    A directory /srv/projects must be owned by the root user and the developers group. Members of developers need full access, including the ability to enter the directory, and all other users must have no access. Which commands meet this requirement?

    Show the answer

    Correct answerB. chown root:developers /srv/projects; chmod 770 /srv/projects

    The chown syntax is user:group, so root:developers sets the right owner and group, and mode 770 gives the group full access and others none. Mode 660 is tempting but lacks the execute bit, so group members could not enter the directory.

    Open this question
  42. Question 42

    Security

    The script deploy.sh currently has mode rw-r--r--. An administrator must make it executable for its owner and group and remove all access for other users, while leaving the existing read and write bits for owner and group untouched. Which command does this?

    Show the answer

    Correct answerB. chmod ug+x,o-r deploy.sh

    Using + adds execute for owner and group, and o-r removes read from others, giving rwxr-x---. The ug=x form is tempting but the = operator replaces the existing bits, which would remove the read and write permissions.

    Open this question
  43. Question 43

    Security

    After content was moved into /srv/site, Apache on an enforcing RHEL-family server returns 403 errors. ls -Z shows the files labeled default_t. The correct label, httpd_sys_content_t, must be applied in a way that survives a full filesystem relabel. Which action meets this requirement?

    Show the answer

    Correct answerC. Run semanage fcontext -a -t httpd_sys_content_t "/srv/site(/.*)?", then restorecon -Rv /srv/site

    semanage fcontext records a persistent file-context rule, and restorecon applies it to the existing files, so the label survives a relabel. chcon changes only the current label, and a relabel resets it to the policy default.

    Open this question
  44. Question 44

    Security

    Files created in the future inside /data/projects must automatically give the auditors group read access, in addition to the normal owner and group permissions. Existing files do not matter. Which command meets this requirement?

    Show the answer

    Correct answerC. setfacl -d -m g:auditors:rX /data/projects

    The -d option sets a default ACL on the directory, which new files and subdirectories inherit. A plain -m entry, even with -R, affects only the directory and files that already exist and is not inherited by new files.

    Open this question
  45. Question 45

    Security

    getfacl on /opt/deploy/report.sh shows the entry user:dev:rwx followed by the comment #effective:r--. The user dev cannot modify the script. Which command restores dev's intended write and execute access?

    Show the answer

    Correct answerD. setfacl -m m::rwx /opt/deploy/report.sh

    The ACL mask caps the effective permissions of named-user and group entries, and here it is r--. Setting it with setfacl -m m::rwx lifts the cap. Changing owner or other bits leaves the mask untouched.

    Open this question
  46. Question 46

    Security

    A web application on an enforcing server cannot reach a remote PostgreSQL database. The audit log shows an AVC denial for httpd_t, and the httpd_can_network_connect_db boolean is off. The fix must persist across reboots, and SELinux must stay in enforcing mode. Which command should the administrator run?

    Show the answer

    Correct answerA. setsebool -P httpd_can_network_connect_db on

    setsebool -P changes the boolean in the running policy and saves it so it persists across reboots, keeping enforcing mode. Without -P, the change works immediately but is lost at the next reboot.

    Open this question
  47. Question 47

    Security

    A file server hosts /srv/reports/q3.txt, which is owned by root:finance with mode 640. An administrator must give the user mara read and write access to this one file without changing its owner, its group, or its mode bits for other users. Which command does this?

    Show the answer

    Correct answerA. setfacl -m u:mara:rw /srv/reports/q3.txt

    setfacl -m with a u:name:perms entry adds a named-user ACL entry and leaves ownership and the base mode bits unchanged. The g: form creates an entry for a group named mara, not the user, so mara would still lack access.

    Open this question
  48. Question 48

    Security

    An administrator configures a Match Group block with ChrootDirectory /srv/sftp/alice and ForceCommand internal-sftp. Alice's login fails and the log reports "bad ownership or modes for chroot directory." What must be true of the chroot directory?

    Show the answer

    Correct answerA. It is owned by root and not writable by any other user or group

    sshd requires every component of the chroot path to be root-owned and not writable by group or others; uploads go into a writable subdirectory. A directory owned by the user or writable by group is rejected as an insecure chroot.

    Open this question
  49. Question 49

    Security

    A security audit finds that an attacker could attempt to authenticate directly as root over SSH, even with a key. Administrators must use personal accounts and sudo instead. Which sshd_config directive BEST meets this requirement?

    Show the answer

    Correct answerC. PermitRootLogin no

    PermitRootLogin no refuses every SSH login as root, regardless of method. PasswordAuthentication no only disables passwords, so root could still log in with a key.

    Open this question
  50. Question 50

    Security

    A server should accept SSH logins only from members of the sshusers group. All other accounts must be refused even when their credentials are valid. Which sshd_config line BEST accomplishes this?

    Show the answer

    Correct answerC. AllowGroups sshusers

    AllowGroups permits login only for members of the listed groups and refuses everyone else. DenyGroups does the opposite, blocking that group, and AllowUsers would treat sshusers as a username rather than a group.

    Open this question