trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.88k stars 77 forks source link

"sudo must be owned by uid 0 and have the setuid bit set" error with sudo-rs, no error with sudo #785

Closed 41Leahcim closed 11 months ago

41Leahcim commented 11 months ago

Describe the bug When I try to use sudo-rs, I get the following error: sudo-rs: sudo must be owned by uid 0 and have the setuid bit set -> error refreshing databases - exit status 1 I don't get this error with the original sudo written in C.

To Reproduce Steps to reproduce the behavior:

  1. Install sudo-rs with cargo install sudo-rs
  2. Run the following command 'yay -Syu'
  3. See error

Expected behavior Yay should update my software, but can't because it can't get root access.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

marlonbaeten commented 11 months ago

Thanks for your report Michael.

sudo-rs is a "setuid" program, the binary needs to be owned by root and have the "setuid" flag set in order to escalate privileges, just like the original sudo. See https://github.com/memorysafety/sudo-rs/blob/main/README.md?plain=1#L31

You can fix this by running the following as root:

chown root /path/to/sudo-rs
chmod 4755 /path/to/sudo-rs