gergeerew
gergeerew

Reputation: 21

python3 binary with SUID cannot execute command as `root`

As the title suggests, my /usr/bin/python3.10 binary cannot be executed under root privilege even though I set the right to -rwsr-xr-x.

I tested using command /usr/bin/python3.10 -c "import os; os.system('whoami')". The result is not root as expected, rather it is the username of the user executed such command.

However when I do a ps auxf command, I could see that the username of the above python process (the value at the first column) is still root.

I am testing on Ubuntu 20.04 and Ubuntu 22.04.

Can somebody help me, please?

Upvotes: 0

Views: 369

Answers (0)

Related Questions