Pass Password to runas from Python [duplicate]

99封情书 提交于 2020-01-11 11:03:33

问题


I need to run a file as another user without it prompting for a password, from my script. How is this done?


回答1:


There's an executable program called SANUR.EXE that's made for just this kind of situation: you can use it to pipe in the password on the command-line, like this: runas /user:domain\username cmd.exe | sanur mysekritpassword.




回答2:


Have the user add whatever it is as a scheduled task with a specific name but no schedule, so it can only be invoked manually. They will need to enter the account credentials when creating the task, but only once. Then you can simply tell schtasks (Windows command line tool) to run it.



来源:https://stackoverflow.com/questions/4011245/pass-password-to-runas-from-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!