https://github.com/antonmeep/goinsu
(Mirror) Switch user, group and execute a program like a pro :+1:
https://github.com/antonmeep/goinsu
betterc cd ci containers dlang docker sudo
Last synced: 4 months ago
JSON representation
(Mirror) Switch user, group and execute a program like a pro :+1:
- Host: GitHub
- URL: https://github.com/antonmeep/goinsu
- Owner: AntonMeep
- License: mit
- Created: 2017-09-13T16:57:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-17T12:44:21.000Z (almost 7 years ago)
- Last Synced: 2025-07-15T09:43:28.582Z (7 months ago)
- Topics: betterc, cd, ci, containers, dlang, docker, sudo
- Language: D
- Homepage: https://gitlab.com/ohboi/goinsu
- Size: 36.1 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
goinsu [](http://code.dlang.org/packages/goinsu)[]()[](https://gitlab.com/AntonMeep/goinsu/pipelines)
=============
**goinsu** - a simple `su` which doesn't mess with TTY and other stuff. It is as simple as "Hey, run this program as this user".
## Why?
```
$ docker run -it --rm ubuntu:trusty su -c "ps aux"
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 7.0 0.0 46644 2628 pts/0 Ss+ 19:07 0:00 su -c ps aux
root 7 0.0 0.0 15584 2100 ? Rs 19:07 0:00 ps aux
$ docker run -it --rm ubuntu:trusty sudo ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 7.0 0.0 46028 3044 pts/0 Ss+ 19:07 0:00 sudo ps aux
root 6 0.0 0.0 15584 2140 pts/0 R+ 19:07 0:00 ps aux
$ docker run -it --rm -v`pwd`/goinsu:/usr/bin/goinsu ubuntu:trusty goinsu root ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 7152 852 pts/0 Rs+ 19:08 0:00 ps aux
```
## Why reinvent gosu?
**goinsu** does the same thing but in 10KB (well, 50KB if compiled as a static executable) instead of 1.8MB.
## Why reinvent su-exec?
**goinsu** is written in the D programming language, which is a high-level programming language with metaprogramming, CTFE, and other cool things you can't find in C.
## betterC?
Yep. goinsu written in a subset of the D programming language, called betterC. Just google for it, ya' know.
## Alternatives
You can use `gosu` or `su-exec`, but they aren't as cool as **goinsu**.