Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drylikov/lua_setuid
A Lua module that provides setuid and chroot functionality.
https://github.com/drylikov/lua_setuid
Last synced: 8 days ago
JSON representation
A Lua module that provides setuid and chroot functionality.
- Host: GitHub
- URL: https://github.com/drylikov/lua_setuid
- Owner: drylikov
- License: mit
- Created: 2024-06-02T11:39:00.000Z (6 months ago)
- Default Branch: drylikov
- Last Pushed: 2024-09-07T00:44:06.000Z (2 months ago)
- Last Synced: 2024-09-07T03:23:39.735Z (2 months ago)
- Language: C
- Size: 5.86 KB
- Stars: 3
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A Lua module that provides `setuid` and `chroot` functionality.
Requirements
------------lua >= 5.1
Usage
-----`setuid.setuid( username )`: Change the current process user ID (real,
effective, saved) to that of `username`.`setuid.chroot( path, username )`: `chroot` into `path`. If `username`
is not `nil`, then change the current process user ID to that of
`username`.We need `setuid.chroot` to optionally accept a username for changing the
user ID after `chroot`ing since `getpwnam` is reading password file
entries behind the scenes. We need to obtain the target user ID before
`chroot`ing, however we require root to `chroot` so we need to actually
set the user ID afterwards.Example
-------local setuid = require( "Lua_setuid" )
-- in a real program you can only do one of these
assert( setuid.chroot( "src", "notroot" ) )
assert( setuid.chroot( "src" ) )
assert( setuid.setuid( "notroot" ) )