site  contact  subhomenews

sudo-sh fix

March 29, 2025 — BarryK

Forum member Caramel has been investigating problems with sudo, or rather, the sudo-sh simplified replacement for sudo:

https://forum.puppylinux.com/viewtopic.php?t=14098

I developed sudo-sh a couple of years ago, here are some posts:

'sudo-sh' is a binary executable, written in C. The new source is version 1.4, uploaded here:

https://distro.ibiblio.org/easyos/source/alphabetical/s/

The big problem that I fixed, maybe that should be "fixed", was that electron-based apps ignore the setuid bit on /usr/bin/sudo-sh (called via sudo), and the hack fix was to detect if sudo-sh has been entered non-root, then pass a message via the pup_event IPC mechanism, to a daemon /root/Startup/sudo-sh-ipc, which will then run sudo-sh as the root user.

Very roundabout. Caramel has identified problems with it, and proposed solutions.

Looking at the first problem; sudo-sh entered non-root, it passes the IPC message as mentioned above, but then exits immediately. This is a problem, it should exit after the second sudo-sh entered-as-root has finished. To fix this, sudo-sh v1.4 now waits on /usr/local/clients/wait-other-sudo-sh to exit. This is a new script see github:

https://github.com/bkauler/woofq/commit/d7f1a17555d7a8fcccad7bfceb9e66d01b18c94a

Tested it, looks OK. Now onto the next reported problem.   

Tags: easy