Skip to content

SUID not working with pyinstaller-derived binaries? #5539

Answered by rokm
Fairlight2cx asked this question in Help
Discussion options

You must be logged in to vote

Seems to work for me:

# program.py
import os
print(f"UID: {os.getuid()}")
print(f"EUID: {os.geteuid()}")
(venv) [rok@alpha pyi-suid]$ pyinstaller program.py --clean --noconfirm --onefile
...
(venv) [rok@alpha pyi-suid]$ ls -l dist/program 
-rwxr-xr-x. 1 rok rok 7241368 feb  8 22:23 dist/program
(venv) [rok@alpha pyi-suid]$ stat -c "%a" dist/program 
755
(venv) [rok@alpha pyi-suid]$ ./dist/program 
UID: 1000
EUID: 1000

(venv) [rok@alpha pyi-suid]$ sudo chown root:root dist/program 
(venv) [rok@alpha pyi-suid]$ sudo chmod 4711 dist/program
(venv) [rok@alpha pyi-suid]$ stat -c "%a" dist/program 
4711
(venv) [rok@alpha pyi-suid]$ ls -l dist/program 
-rws--x--x. 1 root root 7241368 feb  8 22:…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Fairlight2cx
Comment options

Answer selected by Legorooj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants