Interview Prep/Linux/Permissions, ownership, SELinux and mounts

A setuid binary you built doesn't run as root: it still runs with the caller's UID.

AdvancedTroubleshootingPermissions, ownership, SELinux and mounts
Answer

Likely causes → The filesystem is mounted nosuid, the binary is a script (the kernel ignores setuid on scripts), or the owner isn't root.

Diagnose →

ls -l /opt/tool/bin/helper            # expect -rwsr-xr-x root
findmnt -no OPTIONS --target /opt/tool/bin/helper
file /opt/tool/bin/helper

Fix → Avoid setuid entirely: use a narrow sudo rule or file capabilities (setcap cap_net_raw+ep helper). If setuid is really needed, place a compiled binary on a filesystem without nosuid.

Prevent → Treat any setuid requirement as a security review item.

All Linux questions Roadmap: Linux

More on Permissions, ownership, SELinux and mounts