-1

During all my education I've been taught that the setuid would allow anyone that has the execution privilege on a file to run it as the owner. However it seems that I'm not able to setuid a binary and run it as simple user. Here's what I tried :

root@pc# chmod u+s,o+x /usr/bin/apt
root@pc# su - zero
zero@pc$ apt update
[sudo] password for zero: 
Sorry, user zero is not allowed to execute '/usr/bin/apt update' as root on pc.

It works like a charm by default on /usr/bin/passwd but it seems that Linux doesnt allow me to set it on other binaries. What am I doing wrong?

  • 2
    Are you actually calling /usr/bin/apt or do you perhaps have an alias for apt='sudo apt'? – Lambert Nov 8 at 10:55
  • I'm using apt update not the direct path to the binary – Plancton Nov 8 at 10:58
  • 1
    What happens when you try /usr/bin/apt update? – Lambert Nov 8 at 10:59
  • Well... it works! Stupid from me to not try the direct path, but it's weird that the apt doesnt work. – Plancton Nov 8 at 11:01
3

The message shown indicates that apt is 'caught' by sudo probably by an alias.

Use the absolute path to /usr/bin/apt to avoid that and to make sure you are using the actual binary from you've modified the attributes.

  • 1
    One might also use command apt to avoid an alias or function. – Christopher Nov 8 at 12:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.