Hanzala19
Hanzala19

Reputation: 11

How to execute bash commands as non root user from Python?

I am trying to use aquatone from python. It works fine when I run it from VS Code or terminal using either os or subprocess. But When it is start from a parent program which is started on startup as a service. It doesn't work anymore. My guess is that it is due to the parent program being run as root. The parent program requires root privileges.
So is there any way to I can start the aquatone as a non-root user from within python??

Upvotes: 1

Views: 107

Answers (1)

q9i
q9i

Reputation: 205

It depends where you've installed aquatone. By default, if you're using pip, aquatone will be installed to python/site-packages so in order to access the package and Python interpreter any app that runs Python will need to be granted root privileges. This is the simplest way to solve the problem.

Upvotes: 1

Related Questions