I want to execute a script embedding commands requiring a root user from my not root account without sudoing:


/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

  • 1
    On Linux (and other UNIX-like systems), scripts do not honor the setuid bit for very very good reasons. See Allow setuid on shell scripts.
    – AlexP
    Dec 18, 2016 at 12:02

1 Answer 1


From the link of AlexP and the different answers there, here is what works fine:

cat /usr/local/bin/dodo
exec sudo /usr/sbin/pm-suspend-hybrid


ls -l /usr/local/bin/dodo
-rwxr-xr-x 1 laurent family 60 déc.  18 17:47 /usr/local/bin/dodo


cat /etc/sudoers.d/dodo 
%family ALL = (root) NOPASSWD: /usr/sbin/pm-suspend-hybrid

Then for anyone in the family group:


executes sync and pm-suspend-hybrid without password nor sudo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .