[英]How to execute bash commands as non root user from Python?
我正在嘗試使用 python 的 aquatone。 當我使用 os 或 subprocess 從 VS Code 或終端運行它時,它工作正常。 但是當它從作為服務啟動時啟動的父程序啟動時。 它不再起作用了。 我的猜測是這是由於父程序以root身份運行。 父程序需要 root 權限。
那么有什么方法可以讓我從 python 中以非 root 用戶身份啟動 aquatone?
這取決於您安裝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. 這是解決問題的最簡單方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.