Which command enables a service to run at startup on systemd-based systems?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

Which command enables a service to run at startup on systemd-based systems?

Explanation:
On systemd-based systems, making a service run automatically at startup is about enabling its unit so systemd knows to start it during boot. The right command enables the ssh service, which creates the necessary boot-time symlinks so ssh is started when the default target boots. It doesn’t start the service immediately by itself, but it ensures it will launch on the next boot. If you also want to start it right away, you can run a separate start command, but enabling is specifically about boot-time behavior. The other options don’t fit the boot-start goal: updating SysV-style runlevel links isn’t how systemd handles autostart, and the wrapper for SysV scripts doesn’t provide a persistent boot-start setting. Starting the service with a start command runs it now but won’t persist across reboots. Therefore, the correct approach is to enable the service with systemctl enable ssh.

On systemd-based systems, making a service run automatically at startup is about enabling its unit so systemd knows to start it during boot. The right command enables the ssh service, which creates the necessary boot-time symlinks so ssh is started when the default target boots. It doesn’t start the service immediately by itself, but it ensures it will launch on the next boot. If you also want to start it right away, you can run a separate start command, but enabling is specifically about boot-time behavior.

The other options don’t fit the boot-start goal: updating SysV-style runlevel links isn’t how systemd handles autostart, and the wrapper for SysV scripts doesn’t provide a persistent boot-start setting. Starting the service with a start command runs it now but won’t persist across reboots. Therefore, the correct approach is to enable the service with systemctl enable ssh.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy