ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 245 - XK0-005 discussion

Report
Export

A Linux administrator provisioned a new web server with custom administrative permissions for certain users. The administrator receives a report that user1 is unable to restart the Apache web service on this server. The administrator reviews the following output:

[ root@server ] # id user1

UID=1011 (user1) gid=1011 (USER1) groups=1011 (user1), 101 (www-data), 1120 (webadmin)

[ root@server ] # cat /etc/sudoers.d/custom.conf

user1 ALL=/usr/sbin/systemctl start httpd, /usr/sbin/systemctl stop httpd

webadmin ALL=NOPASSWD: /etc/init.d.httpd restart, /sbin/service httpd restart, /usr/sbin/apache2ctl restart

#%wheel ALL=(ALL) NOPASSWD: ALL

Which of the following would most likely resolve the issue while maintaining a least privilege security model?

A.
User1 should be added to the wheel group to manage the service.
Answers
A.
User1 should be added to the wheel group to manage the service.
B.
User1 should have 'NOPASSWD:' after the 'ALL=' in the custom. conf.
Answers
B.
User1 should have 'NOPASSWD:' after the 'ALL=' in the custom. conf.
C.
The wheel line in the custom. conf file should be uncommented.
Answers
C.
The wheel line in the custom. conf file should be uncommented.
D.
Webadmin should be listed as a group in the custom. conf file.
Answers
D.
Webadmin should be listed as a group in the custom. conf file.
Suggested answer: D

Explanation:

The custom.conf file grants sudo privileges to user1 and webadmin for managing the Apache web service, but it uses different commands for each of them. User1 is allowed to use systemctl to start and stop the httpd service, while webadmin is allowed to use init.d, service, or apache2ctl to restart the httpd service. However, the user1 is unable to restart the service, only start and stop it. To fix this, user1 should be able to use the same commands as webadmin, which can be achieved by listing webadmin as a group in the custom.conf file, using the syntax %groupname. This way, user1 will inherit the sudo privileges of the webadmin group, and be able to restart the Apache web service without compromising the least privilege security model.

Reference

Sudo and Sudoers Configuration | Servers for Hackers, section ''Groups''

Chapter 12. Managing sudo access - Red Hat Customer Portal, section ''12.1. Configuring sudo access for users and groups''

asked 02/10/2024
EDUARDO VIDAL
41 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first