How can I check if my program is running with root permission. Does Pathlib offer the possibility to query the USER-ID under Linux
How can I check if my program is running with root permission. Does Pathlib offer the possibility to query the USER-ID under Linux
you can access username with standard library package getpass
import getpass
print(getpass.getuser())
when code is executed with sudo or as root, user is root