Courseiva

LFCS · domain

Service Configuration

Service Configuration is 12% of the LFCS and covers managing systemd units, networking, and core network services on Linux. The exam tests this through live performance-based tasks: you start, enable, mask, or troubleshoot units with systemctl, configure hostname and DNS resolution, and set up services such as SSH, HTTP, NFS, or chrony, then confirm they persist across reboot.

57 questions20 easy19 medium18 hard

Focused practice

Practice Service Configuration questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Service Configuration

Start, enable, mask, and troubleshoot units with systemctl, configure hostname and DNS via hostnamectl and /etc/resolv.conf, and set up services like sshd, httpd, and chronyd. The critical skill is diagnosing failed units with systemctl status and journalctl.

Starting, stopping, enabling, and masking systemd units with systemctl and journalctl

Configuring persistent network settings, hostname, and name resolution on Linux

Setting up and securing SSH server access, keys, and sshd_config options

Deploying services like Apache httpd, NFS exports, or chrony time sync

Watch out for

Common Service Configuration exam traps

  • ▸Running systemctl start without enable, so the service does not survive a reboot during grading
  • ▸Editing sshd_config or exports without reloading or restarting the daemon, leaving changes inactive
  • ▸Using runtime-only ip or hostname commands instead of persistent config files, so settings vanish after reboot

Question index

All Service Configuration questions (57)

Click any question to see the full explanation, or start a practice session above.

1

A Linux administrator needs to ensure that the nginx.service is restarted automatically if it crashes, but only after a 10-second delay, and that it does not restart more than 5 times within 1 minute to avoid a restart loop. Which set of directives in the [Service] section achieves this?

Medium
2

A custom systemd service unit file has been created but the service fails to start with 'Exec format error'. What is the most likely cause?

Medium
3

After editing a service unit file, which command must be run for changes to take effect?

Easy
4

A system administrator needs to ensure the Apache httpd service starts automatically on system boot. Which command should they use?

Easy
5

A system administrator needs to configure a new systemd service unit file for a custom application. The service should start after the network is fully online and requires the /opt/data directory to be mounted. Which section of the unit file should contain the After= and Requires= directives to define these dependencies?

Easy
6

A Linux administrator is configuring a systemd service unit for a database application. The administrator needs to ensure that the service is automatically restarted if it crashes, but only after a 10-second delay, and that the restart is not attempted if the service is explicitly stopped by an administrator. Which two directives should be used in the [Service] section to achieve these requirements? (Choose two.)

Hard
7

An administrator deploys a new custom service using a unit file called myapp.service. The service needs to start automatically at system boot. Which command should the administrator run to achieve this?

Easy
8

A Linux administrator is managing a systemd service called app.service that runs a Java application. The service is configured with Restart=on-failure and RestartSec=5. After a recent update, the application crashes immediately upon start with exit code 1. The administrator notices that systemd keeps restarting the service every 5 seconds indefinitely. Which command should the administrator use to view the number of times the service has been restarted and the current restart limit status?

Hard
9

A service is configured to run as a specific user. Which directive in the [Service] section sets the user?

Medium
10

A service named webserver.service is failing to start. The administrator wants to see the most recent error messages related to this service. Which command provides this information?

Easy
11

A Linux administrator is troubleshooting a custom systemd service named data-sync.service that repeatedly fails with the error 'start request repeated too quickly'. The unit file has Restart=always and RestartSec=5. Which command should the administrator use to reset the failed state and clear the restart counter so the service can be started again?

Medium
12

Which TWO directives are typically used in a systemd service unit file to configure dependencies?

Medium
13

A system administrator manages a database server service (database.service) that experiences periodic CPU spikes, causing excessive load on the server. The administrator wants to limit the service's CPU usage to 25% of a single CPU core. The service is running on a system with cgroup v2. Which directive should be added to the [Service] section of the unit file to achieve this?

Hard
14

A system administrator wants to view the current runtime status of the sshd.service, including whether it is active, its main PID, and recent log entries. Which command should they use?

Easy
15

A system administrator cannot restart a service because another unit 'stop' the request. The status message says 'Unit test.service is not running, but has pending stop job'. What is the most likely cause?

Hard
16

A system administrator configures a web server using systemd. After creating a custom service unit file, the administrator runs `systemctl daemon-reload` but the service still fails to start with a 'Unit not found' error. What is the most likely cause?

Medium
17

Which THREE of the following are valid systemd unit types?

Hard
18

A Linux administrator wants to view the current resource limits (such as CPU and memory) applied to a running systemd service named database.service. Which command will display these limits?

Medium
19

An administrator configures a systemd service with Restart=on-failure and RestartSec=10. What happens if the service exits with a non-zero exit code?

Hard
20

A Linux administrator needs to modify the default runlevel (target) on a systemd-based Linux server so that it boots into a graphical environment by default. Which command should the administrator use?

Easy
21

A developer reports that a web application's logs are not being written to /var/log/myapp.log. The service runs as user 'myapp' and the log directory /var/log/myapp/ has permissions 755 owned by root. What is the most likely cause?

Hard
22

Refer to the exhibit. The service unit file has Restart=on-failure, but systemctl show displays Restart=no. What is the most likely reason?

Medium
23

Order the steps to create a new partition on a disk using fdisk.

Medium
24

A system administrator is managing a web application running as a systemd service on a new Linux server. The application requires a specific environment variable, DATABASE_URL, to be set before starting. The administrator has created a custom service unit file at /etc/systemd/system/webapp.service with the following content: [Unit] Description=Web Application Service [Service] ExecStart=/usr/local/bin/webapp Restart=on-failure The administrator prefers to keep configuration separate from the unit file for easier updates. The service fails to start. Upon investigation, the administrator notices that the DATABASE_URL variable is not being passed to the process. What is the most appropriate course of action to ensure the environment variable is correctly set?

Easy
25

A service unit has the directive 'ExecStartPre=/bin/true' and 'ExecStart=/usr/bin/myapp'. What is the effect of ExecStartPre?

Hard
26

A system administrator is troubleshooting a custom systemd service that fails to start. They want to override a setting in the service's unit file without modifying the original file in /usr/lib/systemd/system/. Which two methods can be used to create a drop-in override? (Choose two.)

Medium
27

Refer to the exhibit. An administrator tries to start myapp.service with 'systemctl start myapp.service' but receives 'Failed to start myapp.service: Unit myapp.service is not loaded properly: Invalid argument'. What is the most likely issue?

Hard
28

A system administrator needs to ensure that a custom service named 'myapp.service' starts automatically after a reboot and also restarts automatically no matter how the service stops, even if it exits normally. Which two actions should the administrator take? (Choose two.)

Easy
29

Which TWO commands can be used to check whether a systemd service is currently running?

Easy
30

A custom service requires that the network is fully operational before it starts. Which directive should be added to the [Unit] section of the service's unit file to ensure this dependency?

Medium
31

Which TWO commands can be used to check the status of the sshd service on a system using systemd?

Medium
32

A Linux administrator is troubleshooting a custom systemd service named backup.service that fails to start. They run systemctl status backup.service and see that the service is in a failed state, but the output does not show detailed error messages. Which command should they use to view the most recent log entries specifically for this service?

Medium
33

A system administrator needs to configure a systemd service so that it restarts automatically only when it exits with a non-zero exit code, but not when it is cleanly stopped by an administrator. The service unit file currently has no Restart directive. Which combination of directives should the administrator use?

Medium
34

An administrator wants to run a script daily at 2 AM. They create a timer unit and a service unit. The service unit uses Type=oneshot. Which of the following timer configurations is correct?

Hard
35

Refer to the exhibit. A Linux administrator sees that 'myapp.service' is in a failed state with exit status 1. To troubleshoot, which command should the administrator use to view the full error output that the service produced before exiting?

Hard
36

Which systemd unit type is used to group services and other units together for boot execution?

Easy
37

An administrator is creating a systemd timer unit called backup.timer that should trigger backup.service every day at 2:00 AM. The timer should also run the service immediately if the system was powered off at 2:00 AM. Which timer directives are required to achieve this?

Hard
38

An administrator runs 'systemctl status sshd' and sees the output above. The administrator wants sshd to start automatically at boot. Which command should be used?

Medium
39

Which command enables a service to start automatically at boot in a systemd-based system?

Easy
40

A system administrator wants to configure a custom service to start automatically at boot. Which command accomplishes this?

Easy
41

Which THREE of the following are valid directives for the [Service] section of a systemd unit file?

Medium
42

A Linux administrator needs to temporarily stop a service named 'httpd' without disabling it from starting automatically on subsequent boots. Which command should be used?

Easy
43

A system administrator wants to change the default runlevel (target) of a Linux system from graphical.target to multi-user.target. Which command should they use?

Easy
44

A Linux administrator is creating a custom systemd timer unit named backup.timer to schedule a daily backup script. The administrator wants the timer to trigger the backup service exactly at 2:00 AM every day, regardless of when the system was last booted. Which timer directive should be used in the [Timer] section of backup.timer?

Hard
45

A system administrator is creating a systemd service unit for a custom application. The application requires that a specific environment variable, APP_ENV=production, be set before the service starts. The administrator wants this variable to be available only to this service, not system-wide. Which directive should be used in the service unit file?

Hard
46

A Linux administrator is configuring a custom systemd service called backup.service. The service should run a backup script only when the server is connected to AC power and not running on battery. Which condition directive should be added to the [Unit] section of backup.service?

Medium
47

Which command displays the current status of all active services?

Easy
48

A server runs a custom application that listens on TCP port 8080. The administrator wants to ensure the application starts automatically on boot and restarts if it crashes. Which systemd unit file directive should be used to achieve the restart behavior?

Hard
49

A junior administrator has written a custom systemd service unit file named backup.service in /etc/systemd/system/. The unit is intended to run a backup script once per day. After placing the file, the administrator runs systemctl start backup.service, but systemd reports 'Unit backup.service not found.' The file exists and has correct syntax. Which command should the administrator run to make systemd aware of the new unit file?

Easy
50

A Linux administrator is configuring a custom systemd service that must not start until a network share is mounted. The mount is managed by a systemd mount unit named mnt-data.mount. Which directive should be added to the [Unit] section of the service unit to enforce this ordering?

Medium
51

Which THREE actions will affect the state of a systemd service that is currently running? (Choose three.)

Hard
52

A Linux administrator is configuring a systemd service that must only start after the network is fully online and must stop if the network goes down. The unit file currently has After=network.target. However, the service sometimes starts before DNS resolution is available, causing failures. Which target should the administrator use instead to ensure the network is fully configured and DNS is available?

Hard
53

An administrator wants to limit the CPU usage of a service to at most 50% of a single CPU core. Which directive should be set in the [Service] section of the unit file?

Hard
54

An administrator needs to configure a service to run as a non-root user for security reasons. Which systemd unit file directive accomplishes this?

Easy
55

A Linux administrator is configuring a systemd service unit for a custom application. The application requires that the /opt/app/data directory exists and is writable before the service starts. The administrator wants to ensure this directory is created automatically if it does not exist. Which systemd directive should be added to the [Service] section to achieve this?

Medium
56

To check the details of a failed systemd service unit, including the last log entries, which command is most appropriate?

Easy
57

A system administrator needs to prevent a service named backup.service from starting automatically at boot, while keeping it available for manual start. The service is currently enabled. Which command should the administrator run?

Easy

Frequently asked questions

What does the Service Configuration domain cover on the LFCS exam?
Start, enable, mask, and troubleshoot units with systemctl, configure hostname and DNS via hostnamectl and /etc/resolv.conf, and set up services like sshd, httpd, and chronyd. The critical skill is diagnosing failed units with systemctl status and journalctl.
How many questions are in this domain?
This page lists all 57 Service Configuration questions in the LFCS question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Service Configuration questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
lf-lfcs LF-LFCS service configuration Practice Questions