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?


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?