A minimal tool to switch user/group IDs and execute a program directly, avoiding TTY and signal issues.
su-exec is a simple, lightweight command-line tool that switches user and group IDs (and setgroups) and then executes a program directly. It solves the problem of running processes with different privileges in containerized environments without the TTY and signal propagation issues that occur with traditional tools like `su` and `sudo`.
System administrators and developers working with Docker containers or Linux environments who need to run processes with non-root privileges securely and efficiently.
Developers choose su-exec over alternatives like gosu because it is extremely minimal (only about 10KB), avoids child process complications, and integrates seamlessly into container workflows for reliable privilege management.
switch user and group id and exec
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Runs the target program directly rather than as a child process, avoiding TTY handling and signal propagation issues common with su and sudo, as demonstrated in the README's ps aux example.
At only about 10KB, it's significantly smaller than alternatives like gosu (1.8MB), making it ideal for minimizing container image size and resource usage.
Accepts user-spec in formats like 'nobody' or 'nobody:ftp', including numeric UID/GID, simplifying privilege switching in commands without complex configuration.
Focuses on solving privilege issues in Docker and similar environments, ensuring reliable process management without the overhead of traditional tools.
Must be executed by root to change UID/GID, which can introduce security risks if misused and limits its applicability in non-root or restricted environments.
Lacks advanced capabilities such as logging, audit trails, configuration files, or error handling, making it unsuitable for enterprise-grade security or complex workflows.
Provides minimal validation or safeguards, relying on the caller to ensure correct parameters, which can lead to failures or security loopholes in scripts.
su-exec is an open-source alternative to the following products: