6

my username is allowed to execute

sudo command

then why does this bomb

strace sudo command

with the error:

sudo: must be setuid root

1 Answer 1

8

The "must be setuid root" is caused by running sudo in strace.

From man strace:

BUGS Programs that use the setuid bit do not have effective user ID privileges while being traced.

If you want to strace setuid things and have the setuid bit honored, you have to run strace as root with the -u option (this question has already been submitted : Strange strace and setuid behaviour: permission denied under strace, but not running normally)

5
  • OK but, "command" does not have setuid bit. I am able to run it as root because that is how the sudoers file is setup.
    – user322908
    Commented Mar 30, 2016 at 15:10
  • 1
    Oh I see, it is not about "command", it is about "sudo" - sudo has setuid set.
    – user322908
    Commented Mar 30, 2016 at 15:12
  • Yes, you got it. Commented Mar 30, 2016 at 15:14
  • Why not sudo strace ...? Commented Jul 6, 2018 at 10:56
  • sudo strace will run strace with root privileges, but will not trace sudo.
    – Richlv
    Commented Nov 5, 2018 at 11:02

You must log in to answer this question.

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