SysAdmin

Sudo access to a single service – RHEL 7 / CentOS 7

JJ
Jobin Joseph · Founder and CEO
·Published 24 January 2016·1 min read

Issue

You need to give only the apache / httpd restart permission to the developers via sudo.

Solution

Cmnd_Alias WEBDEVS = /sbin/service httpd *
user1 ALL = NOPASSWD:WEBDEVS

sudo /sbin/service httpd restart

Eg:

[root@rhel7 ~]# su - user1
[user1@rhel7 ~]$ sudo /sbin/service httpd restart
Redirecting to /bin/systemctl restart httpd.service

Jobin Joseph
Jobin Joseph, Founder and CEO
5x AWS Certified, ISO 27001:2022 Lead Implementer, 17+ years building cloud infrastructure for regulated industries.
About Jobin →

Reading this because your AWS bill or uptime is a problem?

30 minutes, direct with the founder, no sales pitch: one specific recommendation for your AWS workload.

Book a free 30-minute review
30 min Free Consultation →