Make python enter password when running a csh scri

2020-02-26 11:18发布

I'm writing a python script that executes a csh script in Solaris 10. The csh script prompts the user for the root password (which I know) but I'm not sure how to make the python script answer the prompt with the password. Is this possible? Here is what I'm using to execute the csh script:

import commands

commands.getoutput('server stop')

7条回答
我想做一个坏孩纸
2楼-- · 2020-02-26 12:09

To avoid having to answer the Password question in the python script I'm just going to run the script as root. This question is still unanswered but I guess I'll just do it this way for now.

查看更多
登录 后发表回答