Linux – Centos Apache and Permissions (Sudoers maybe)

apache-2.2centosgroupslinuxpermissions

OS: CentOS 5.5

I have a 2 users which are part of a group. I would like to allow that group to be able stop and start Apache, but not grant access as root.

I have been looking at the Sudoers approach but I understand this will fail as a process trying to listen on ports between 1 – 1024 requires root access.

Could anyone suggest a solution?

Thanks in advance

Best Answer

With sudo you can give fine grained elevated access to your users. Write a small script that does exactly what you want your users to be able to do. Set the file permissions on the script so that your users cannot edit it. Then grant your users access to run just the script via sudo. Then add a line like below for each user into the sudoers file with the visudo command

usera ALL = (ALL) /path/to/script

EDIT

The script can be as simple as

#!/bin/bash
/usr/sbin/apachectl restart

Make the ownership of the script root:root and the permissions 500.