John Fano
2010-07-27 12:13:52 UTC
Hi Everyone,
I recently found Paramiko and it's a great fit for my project.
However I am having an issue running a command remotely. I have a
windows machine running Cygwin with OpenSSH. Basically I am touching
a batch file and adding net share commands to it. Once I am done I
want to execute the batch file and have it share all the folders I
just created. I would just send the net share commands but since the
backslash means something to Python I have to put in a million of them
just to get them to come out right on the other end. Whereas I can
just echo the command to a batch file with normal backslashes to the
remote file and it comes out correct. Anyway, all goes well until I
try to execute the batch file.
Running this:
stdin, stdout, stderr = ssh.exec_command('/cygdrive/c/test/shares.bat')
I get the following stderr output:
System error 5 has occurred.
Access is denied.
Checking stdout shows that the command is complete and correct:
C:\cygwin\home\john>net share test$=c:\test\testfolder
Now, if I manually SSH to my windows host from the command line I can
issue the same command "/cygdrive/c/test/shares.bat" and it works
perfectly. So I know the batch file is good and I know that Cygwin is
interpreting and executing it correctly, so that leaves Python and/or
Paramiko. I am logging in to the remote host with a domain account
that has local admin rights.
Anyone have any thoughts?
John :-)
------------------------------
"Any people, nation, or
language that speaks anything
against the God of Shadrach,
Meshach, and Abednego shall be
torn limb from limb, and their
houses laid in ruins, for there
is no other god who is able to
rescue in this way."
- Daniel 3:29
I recently found Paramiko and it's a great fit for my project.
However I am having an issue running a command remotely. I have a
windows machine running Cygwin with OpenSSH. Basically I am touching
a batch file and adding net share commands to it. Once I am done I
want to execute the batch file and have it share all the folders I
just created. I would just send the net share commands but since the
backslash means something to Python I have to put in a million of them
just to get them to come out right on the other end. Whereas I can
just echo the command to a batch file with normal backslashes to the
remote file and it comes out correct. Anyway, all goes well until I
try to execute the batch file.
Running this:
stdin, stdout, stderr = ssh.exec_command('/cygdrive/c/test/shares.bat')
I get the following stderr output:
System error 5 has occurred.
Access is denied.
Checking stdout shows that the command is complete and correct:
C:\cygwin\home\john>net share test$=c:\test\testfolder
Now, if I manually SSH to my windows host from the command line I can
issue the same command "/cygdrive/c/test/shares.bat" and it works
perfectly. So I know the batch file is good and I know that Cygwin is
interpreting and executing it correctly, so that leaves Python and/or
Paramiko. I am logging in to the remote host with a domain account
that has local admin rights.
Anyone have any thoughts?
John :-)
------------------------------
"Any people, nation, or
language that speaks anything
against the God of Shadrach,
Meshach, and Abednego shall be
torn limb from limb, and their
houses laid in ruins, for there
is no other god who is able to
rescue in this way."
- Daniel 3:29