Article 547PG Restrict the normal user to run only limited set of commands on CentOS 8

Restrict the normal user to run only limited set of commands on CentOS 8

by
aria_redhat
from LinuxQuestions.org on (#547PG)
Hello. I have a Centos 8 server on which I have installed mariadb and nginx. I have created a user named Test on the server, but I want it to only be able to execute the following commands when the test user logs on to the server.
Code:# systemctl restart nginx
# systemctl restart mariadb
# systemctl restart zabbix-agent
I have restricted user access according to this link, but when I test the above commands with user access, it asks me for the root user password.
Code:$ systemctl restart nginx
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to restart 'nginx.service'.
Authenticating as: root
Password:How can I restrict the user to a certain number of commands in cetnos 8?latest?d=yIl2AUoC8zA latest?i=jaJY86u0N8U:cRRgAkf5m5g:F7zBnMy latest?i=jaJY86u0N8U:cRRgAkf5m5g:V_sGLiP latest?d=qj6IDK7rITs latest?i=jaJY86u0N8U:cRRgAkf5m5g:gIN9vFwjaJY86u0N8U
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments