Pass Password to runas from Python [duplicate]
Asked Answered
J

2

2

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

Juttajutty answered 25/10, 2010 at 0:54 Comment(5)
This may not be for something nefarious, but it sure sounds like it. Good luck with that.Passover
Which OS are you targeting ... I mean ... using?Globate
Actually, it isn't anything nefarious, @Justin Peel. Not targeting either, @Ben. It is actually for a legit application. It is using the Windows OS. I'm still learning about hacking etc. :) Know of any good resources?Juttajutty
You should just be able to use popen, provided you have the proper permissions...Rapid
check that answer: #44054628Endways
I
2

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.

Ivoryivorywhite answered 25/10, 2010 at 18:14 Comment(1)
the link is dead, and there are better alternatives than using that program. psexec is one, and sending chars to the input is another (see linked question)Endways
P
0

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.

Pox answered 25/10, 2010 at 2:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.