[英]Python Script throwing TTY Sudo error when running SUDO Command
[英]standard in must be a tty Python script removing Sudo
我正在尝试运行命令
"sudo service awslogs start"
从python脚本。 我无法使用“ sudo”,因此我将命令更改为
"su -c 'service awslogs start'"
但这似乎也不起作用。 我仍然收到错误
su:用户if = / dev / null不存在
要么
中的标准必须是tty
关于如何解决此问题的任何想法?
sudo -S
从stdin读取,请参见man sudo
:
-S, --stdin
Write the prompt to the standard error and read the password from the
standard input instead of using the terminal device. The password must be
followed by a newline character.
您也可以更改/etc/sudoer
以允许您的用户在不使用sudo的情况下运行特定命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.