FlashGenius Logo FlashGenius
Login Sign Up

CompTIA Linux+ Practice Questions: Services and User Management Domain

Test your CompTIA Linux+ knowledge with 10 practice questions from the Services and User Management domain. Includes detailed explanations and answers.

CompTIA Linux+ Practice Questions

Master the Services and User Management Domain

Test your knowledge in the Services and User Management domain with these 10 practice questions. Each question is designed to help you prepare for the CompTIA Linux+ certification exam with detailed explanations to reinforce your learning.

Question 1

A user reports they cannot access a web application hosted in a Docker container on a SUSE server. You suspect the container is not running. What command would you use to verify the container's status?

A) docker ps

B) docker inspect

C) docker status

D) docker run

Show Answer & Explanation

Correct Answer: A

Explanation: The 'docker ps' command lists all running containers, which allows you to verify if the container is running. 'docker inspect' provides detailed information about a container but does not directly show running status. 'docker status' is not a valid Docker command, and 'docker run' is used to start a new container.

Question 2

A service on your SUSE server fails to start, and you suspect it's due to a missing dependency. Which command helps identify the service dependencies?

A) systemctl list-dependencies service_name

B) systemctl status service_name

C) systemctl show service_name

D) systemctl enable service_name

Show Answer & Explanation

Correct Answer: A

Explanation: The 'systemctl list-dependencies service_name' command lists all dependencies for a given service, helping identify potential missing dependencies. Option B, 'systemctl status', provides the current status but not dependencies. Option C, 'systemctl show', provides detailed properties of the service but not a dependency list. Option D, 'systemctl enable', is used to enable the service at boot but does not show dependencies.

Question 3

A user on a CentOS system is unable to log in via SSH. You suspect there might be an issue with the user's account configuration. Which file would you check to verify if the user's shell is set correctly?

A) /etc/passwd

B) /etc/shadow

C) /etc/ssh/sshd_config

D) /etc/group

Show Answer & Explanation

Correct Answer: A

Explanation: The '/etc/passwd' file contains information about user accounts, including the shell assigned to each user. If the shell is set incorrectly, the user might be unable to log in. Option B is incorrect because '/etc/shadow' contains password information, not shell configurations. Option C is incorrect because '/etc/ssh/sshd_config' contains SSH daemon configurations. Option D is incorrect because '/etc/group' contains group information, not shell assignments.

Question 4

You need to create a new user 'jdoe' on a Ubuntu server and ensure their home directory is created. Which command should you use?

A) useradd jdoe

B) adduser jdoe

C) useradd -m jdoe

D) adduser -m jdoe

Show Answer & Explanation

Correct Answer: B

Explanation: On Ubuntu, the 'adduser' command is a higher-level utility that automatically creates a home directory. Option A, 'useradd', does not create a home directory by default unless used with the '-m' option. Option C is correct if using 'useradd', but 'adduser' is preferred on Debian-based systems like Ubuntu. Option D repeats the '-m' flag, which is unnecessary with 'adduser'.

Question 5

You are tasked with ensuring a service starts automatically on boot on a CentOS server. Which command should you use?

A) chkconfig on

B) systemctl enable

C) update-rc.d defaults

D) service autostart

Show Answer & Explanation

Correct Answer: B

Explanation: The 'systemctl enable ' command is used to enable a service to start automatically at boot time on systems using systemd, such as CentOS. Option A, 'chkconfig on', is used in older init systems. Option C, 'update-rc.d defaults', is used in Debian-based systems like Ubuntu, not CentOS. Option D, 'service autostart', is not a valid command.

Question 6

A user reports they cannot access a service on a SUSE server that should be running. You suspect a firewall issue. Which command helps verify the firewall status?

A) firewalld --state

B) iptables -L

C) ufw status

D) systemctl status firewalld

Show Answer & Explanation

Correct Answer: D

Explanation: The 'systemctl status firewalld' command shows the status of the firewalld service, which manages the firewall on SUSE systems. Option A, 'firewalld --state', is not a valid command. Option B, 'iptables -L', lists iptables rules but does not provide service status. Option C, 'ufw status', is for Ubuntu systems using UFW.

Question 7

In a containerized environment using Docker, which command would you use to check the logs of a container running on a CentOS host?

A) docker logs container_id

B) docker inspect container_id

C) docker ps -a

D) docker exec -it container_id bash

Show Answer & Explanation

Correct Answer: A

Explanation: 'docker logs container_id' retrieves the logs for the specified container, which is useful for troubleshooting. 'docker inspect' provides detailed information about a container, 'docker ps -a' lists all containers but does not show logs, and 'docker exec -it container_id bash' opens an interactive shell in the container.

Question 8

A user reports that they cannot access a specific service on an Ubuntu server. You suspect a firewall issue. Which command would you use to list all firewall rules and verify the service is allowed?

A) iptables -L

B) ufw status

C) firewall-cmd --list-all

D) netstat -tuln

Show Answer & Explanation

Correct Answer: B

Explanation: On Ubuntu, which uses UFW (Uncomplicated Firewall), the command 'ufw status' lists all active firewall rules. Option A, 'iptables -L', lists rules for iptables but is not the default firewall tool on Ubuntu. Option C, 'firewall-cmd --list-all', is used with firewalld, which is not typically used on Ubuntu. Option D, 'netstat -tuln', lists open ports and listening services but does not show firewall rules.

Question 9

A user complains that they cannot execute a script in their home directory on an Ubuntu server. You suspect it is a permissions issue. What command would you use to quickly grant the user execute permissions on the script?

A) chmod +x /home/user/script.sh

B) chown user:user /home/user/script.sh

C) chgrp user /home/user/script.sh

D) setfacl -m u:user:x /home/user/script.sh

Show Answer & Explanation

Correct Answer: A

Explanation: The command 'chmod +x /home/user/script.sh' grants execute permissions to the script. Option B changes ownership but not permissions. Option C changes the group but not permissions. Option D uses ACLs to set execute permissions, which is more complex than necessary for this task.

Question 10

You need to create a new user on a SUSE Linux server that can run specific administrative commands without a password prompt using sudo. Which file should you edit?

A) /etc/passwd

B) /etc/shadow

C) /etc/sudoers

D) /etc/group

Show Answer & Explanation

Correct Answer: C

Explanation: The '/etc/sudoers' file is used to configure sudo privileges, including allowing users to run commands without a password. Option A contains user account information but not sudo privileges. Option B contains password data. Option D lists groups but not sudo configurations.

Ready to Accelerate Your CompTIA Linux+ Preparation?

Join thousands of professionals who are advancing their careers through expert certification preparation with FlashGenius.

  • ✅ Unlimited practice questions across all CompTIA Linux+ domains
  • ✅ Full-length exam simulations with real-time scoring
  • ✅ AI-powered performance tracking and weak area identification
  • ✅ Personalized study plans with adaptive learning
  • ✅ Mobile-friendly platform for studying anywhere, anytime
  • ✅ Expert explanations and study resources
Start Free Practice Now

Already have an account? Sign in here

About CompTIA Linux+ Certification

The CompTIA Linux+ certification validates your expertise in services and user management and other critical domains. Our comprehensive practice questions are carefully crafted to mirror the actual exam experience and help you identify knowledge gaps before test day.