Executing Commands From Windows Service

Sean DiZazzo half.italian at gmail.com
Tue Feb 9 18:09:50 CET 2010


On Feb 9, 6:52 am, T <misceveryth... at gmail.com> wrote:
> On Feb 8, 2:25 pm, David Bolen <db3l.... at gmail.com> wrote:
>
>
>
> > T <misceveryth... at gmail.com> writes:
> > > I have a script, which runs as a Windows service under the LocalSystem
> > > account, that I wish to have execute some commands.  Specifically, the
> > > program will call plink.exe to create a reverse SSH tunnel.  Right now
> > > I'm using subprocess.Popen to do so.  When I run it interactively via
> > > an admin account, all is well.  However, when I'm running it via
> > > service, no luck.  I'm assuming this is to do with the fact that it's
> > > trying to run under the LocalSystem account, which is failing.  What
> > > would be the best way around this?  Thanks!
>
> > The LocalSystem account is not, if I recall correctly, permitted to
> > access the network.
>
> > You'll have to install the service to run under some other account that
> > has appropriate access to the network.
>
> > -- David
>
> The more testing I do, I think you may be right..I was able to get it
> to work under a local admin account, and it worked under debug mode
> (which would also have been running as this user).  I'm a bit
> surprised though - I was under the assumption that LocalSystem had
> rights to access the network?

You really need a way to see the error you are getting.  If you can't
get it to show you the error in the shell, set up some logging to a
file, and find the error that way.  I think the user can access the
network just fine, but that maybe plink.exe is not in his path or some
such thing.

Find the error!



More information about the Python-list mailing list