I've changed the shutdown command to be able to run it as normal user (not root):

sudo chmod a+s /sbin/shutdown

And now I cannot get back to root only when running shutdown:

$ sudo chmod a-s /sbin/shutdown 
$ ls -l /sbin/shutdown 
lrwxrwxrwx 1 root root 14 May  5 20:55 /sbin/shutdown -> /bin/systemctl

$ ls -l /bin/systemctl
-rwxr-xr-x 1 root root 659848 May  5 20:55 /bin/systemctl
  • -rwxr-xr-x looks fine to me: no SUID bit there any more. Can you still run it as a regular user? – David Foerster May 21 '16 at 20:02
  • yes, shutdown can be issued with normal user with no restrictions – Greg May 21 '16 at 20:03
  • Then it certainly isn't because of the permissions on the executable. Did you change any other access policy or permissions that may affect this? – David Foerster May 21 '16 at 20:04
  • no, just added s bit and removing it to shutdown – Greg May 21 '16 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.