Skip to content

A simple setuid wrapper program, intended to launch shell scripts with elevated privileges.

Notifications You must be signed in to change notification settings

jfredrickson/setuid-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

setuid-wrapper

Just a simple tool that can be used to start shell scripts with elevated privileges.

Why?

Linux ignores the setuid bit on interpreted executables (e.g., shell scripts, interpreted languages, etc). This is for security reasons. Therefore, in order to run a script with setuid privileges, we need to execute it from a native binary executable that actually has the setuid bit on it. That's where this wrapper comes into the picture: it serves as the native binary that carries the setuid bit.

Compiling

gcc -o setuid-wrapper setuid-wrapper.c

Installing

chown root setuid-wrapper
chmod 4755 setuid-wrapper

Usage

Assuming myscript.sh is the script you want to run with elevated privileges, create a script that contains:

#!/bin/sh
/path/to/setuid-wrapper /path/to/myscript.sh

Then just run the above script in order to execute myscript.sh with superuser privileges.

Security Warning

Note that this is a personal tool. It wasn't designed with multiuser security in mind. Pretty much anyone will be able to execute anything with superuser privileges by using this script.

About

A simple setuid wrapper program, intended to launch shell scripts with elevated privileges.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages