How to run strace on setuid binaries like sudo?

Solution Verified - Updated -

Issue

  • During debugging session of issues wtih the sudo command for a non-root user there is a need to collect strace output for the sudo command, so that the system calls can be investigated.

  • Running strace on sudo as a non-root user fails similarly to the following:

    $ strace -Tttfvyys 4096 -o sudo-strace.txt sudo -i
    sudo: effective uid is not 0, is /bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
    

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content