Sample Header Ad - 728x90

Granting privileges using visudo still prevents user to execute command

0 votes
1 answer
91 views
Following this solution, I want to grant to the user daemon the execution of /bin/date. Here what I did: 1. find the user that apache2 uses when spawning:
# ps | grep httpd
    252 root     /usr/bin/httpd -k start
    260 daemon   /usr/bin/httpd -k start
    262 daemon   /usr/bin/httpd -k start
    264 daemon   /usr/bin/httpd -k start
    467 root     grep httpd
2. find the right path for date:
# which date /bin/date 3. using visudo add the following lines:
Cmnd_Alias DATE=/bin/date                                               
    daemon ALL=NOPASSWD: DATE
4. reboot

5. test the new privileges:
# sudo -u daemon date -s "2023-09-09 10:16:00" date: can't set date: Operation not permitted Sat Sep 9 10:16:00 UTC 2023 Is there anything wrong in my syntax? I also tried with: ALL ALL=NOPASSWD: DATE but it's the same. It's a Buildroot environment.
Asked by Mark (815 rep)
Sep 9, 2023, 08:21 AM
Last activity: Sep 9, 2023, 09:16 AM