https://github.com/msantos/fchmodexec
fchmod(2) inherited file descriptors before exec(3)'ing a command
https://github.com/msantos/fchmodexec
exec fd
Last synced: 12 months ago
JSON representation
fchmod(2) inherited file descriptors before exec(3)'ing a command
- Host: GitHub
- URL: https://github.com/msantos/fchmodexec
- Owner: msantos
- License: isc
- Created: 2021-03-18T11:25:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-02T12:38:34.000Z (over 1 year ago)
- Last Synced: 2025-02-13T05:30:10.509Z (over 1 year ago)
- Topics: exec, fd
- Language: C
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
fchmodexec *mode* *fd* *...* -- *cmd* *...*
LD_PRELOAD=libdisablefchmod.so *command* *...*
# DESCRIPTION
fchmodexec - fchmod(2) inherited file descriptors before exec(3)'ing
a command
`fchmodexec` runs as part of an exec chain to change the permissions of
any file descriptors inherited from the parent process before executing
a program.
libdisablefchmod: Disables use of fchmod(2) on stdin and stdout by
dynamically linked executables.
# EXAMPLES
## fchmodexec
```
$ umask 077; (fchmodexec 644 1 -- ls -al out) > out
$ cat out
-rw-r--r-- 1 msantos msantos 0 Mar 18 07:32 out
$ ls -al out
-rw-r--r-- 1 msantos msantos 48 Mar 18 07:32 out
```
## libdisablefchmod
```
$ umask 022; (LD_PRELOAD=libdisablefchmod.so fchmodexec 111 1 -- ls -al out) > out
$ cat out
-rw-r--r-- 1 msantos msantos 0 Mar 18 07:32 out
$ ls -al out
-rw-r--r-- 1 msantos msantos 48 Mar 18 07:32 out
```
# OPTIONS
None.
# BUILDING
```
make
# also build libdisablefchmod
make all
# statically linked executable
./musl-make
```
# SEE ALSO
*exec(3)*, *fchmod*(2)