I want to execute a script embedding commands requiring a root user from my not root account without sudoing:
/usr/local/bin/dodo
#!/bin/bash
/bin/sync && /usr/sbin/pm-suspend-hybrid
What I did is making it root and setting the SUID bit:
chown root:root /usr/local/bin/dodo
chmod a+xrs /usr/local/bin/dodo
But when I try to execute it, the result is:
$ /usr/local/bin/dodo
This utility may only be run by the root user.
I have tried also a sudoer solution by adding the file /etc/sudoers.d/dodo
:
%family ALL = (root) NOPASSWD: /usr/local/bin/dodo
Which is supposed, if I am not mistaken, to authorise users of group family to execute dodo as root without password. But the result is the same.
What do I miss please? I am on Debian Jessie
EDIT: In the last case, sudo dodo
works without password