tianon/gosu

Simple Go-based setuid+setgid+setgroups+exec

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 11 minutes ago
Added to GitGenius on September 13th, 2026
Created on May 12th, 2014
Open Issues & Pull Requests: 8 (+0)
GitHub issues: Enabled
Number of forks: 355
Total Stargazers: 5,010 (+0)
Total Subscribers: 80 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 3.5 hours
Mean response time: 4.4 days
90th percentile: 47.4 hours
Tracked items: 12

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 5
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 417 days
Stale 30+ days: 5
Stale 90+ days: 4

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

gosu is a lightweight privilege-dropping tool that simplifies running applications as a specific non-root user without the complexity and signal-handling issues of su and sudo.

The problem gosu solves is the awkward TTY and signal-forwarding behavior of traditional privilege-switching tools. Rather than forking and managing a subprocess, gosu uses the same user and group processing code that Docker's libcontainer uses, then directly execs the target process. Once the exec happens, gosu is no longer resident in the process lifecycle, leaving signal handling and TTY management to the invoking and invoked processes where they naturally belong.

gosu is designed specifically for stepping down from root to a non-privileged user during container startup, typically in a Dockerfile ENTRYPOINT. The tool achieves exact parity with Docker's --user flag because it reuses Docker's own user and group processing logic. The README names several alternatives: setpriv from util-linux provides similar behavior on newer systems, chroot with --userspec offers comparable functionality, and su-exec is a minimal C rewrite available in Alpine Linux repositories that produces a smaller binary. The README explicitly warns that uses beyond the core container startup case could suffer from privilege-escalation vulnerabilities and recommends reviewing the discussion around CVE-2016-2779 for context.

The project maintains a test suite in Dockerfile.test-alpine and test.sh that covers edge cases in user and group handling. Development activity shows ongoing maintenance with attention to security considerations and compatibility across different Linux distributions and architectures.