By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,035 Members | 1,995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,035 IT Pros & Developers. It's quick & easy.

Executing a file remotely

P: n/a
Hi,

I was wondering how I would execute a file remotely? For example,
test.exe resides on machine A, my python script is running on Machine
B. I would like to execute "test.exe -parameters" on machine A from a
script running on machine B.

Does anyone know how to do this easily in python?

Thanks a lot.
Hank
Jul 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On 11 Feb 2004 15:20:41 -0800, Hank wrote:
I was wondering how I would execute a file remotely?


That depends on how you'd execute any command on a remote machine. On
Unix systems, the preferred way these days is to use ssh:

bignose@desktop$ ssh bignose@remoteserver 'command -with -args'

Assuming the 'ssh' command is available on the local machine, you could
execute the above command within the Python script using os.system():

<http://www.python.org/doc/1.5.2p2/lib/os-process.html>

--
\ "I washed a sock. Then I put it in the dryer. When I took it |
`\ out, it was gone." -- Steven Wright |
_o__) |
Ben Finney <http://bignose.squidly.org/>
Jul 18 '05 #2

P: n/a
In article <sl*******************************@rose.localdomai n.fake>,
Ben Finney <bi****************@and-benfinney-does-too.id.au> wrote:
On 11 Feb 2004 15:20:41 -0800, Hank wrote:
I was wondering how I would execute a file remotely?


That depends on how you'd execute any command on a remote machine. On
Unix systems, the preferred way these days is to use ssh:

bignose@desktop$ ssh bignose@remoteserver 'command -with -args'

Assuming the 'ssh' command is available on the local machine, you could
execute the above command within the Python script using os.system():

<http://www.python.org/doc/1.5.2p2/lib/os-process.html>

Jul 18 '05 #3

P: n/a
On Thu, 12 Feb 2004 00:29:42 -0000, Cameron Laird wrote:
I believe soundwave56 is focused on Windows hosts. There, the correct
initial answer to, "how would I execute a file remotely?" is, through
a security breach.
No, the correct answer (on any operating system) is "through a
remote-execution facility". "Security breach" is dependent on the
security policy in place; remote execution can be a perfectly
permissible operation, or a serious breach of security, depending on
the specific circumstances and what the security policy allows.
That's a serious answer. Operating systems are not *supposed* to
allow "outsiders" to execute processes.


Utter rot. Operating systems are supposed to do what the person owning
the hardware tells them to do.

Whether "outsiders" are allowed to execute programs on the operating
system is entirely dependent on how you define "outsiders". Some
operating systems are designed to treat remote users and local users
identically; on such systems, "outsider" is not a function of "remote or
local", but rather "permitted or not permitted".

On other operating systems, multiple-user and networking is a bolt-on
afterthought, and an unnecessary line is drawn between local and remote
users. The availability of smooth, simple remote-execution facilities
on such operating systems will likely be poor.

--
\ "When a well-packaged web of lies has been sold to the masses |
`\ over generations, the truth will seem utterly preposterous and |
_o__) its speaker a raving lunatic." -- Dresden James |
Ben Finney <http://bignose.squidly.org/>
Jul 18 '05 #4

P: n/a
This is strictly for automated software testing on windows. Test
scripts on one machine, application under test on another machine.
This is why i need to run files remotely.

I couldn't find any specific python code that would do the job, so I
just use PsExec from www.sysinternals.com. I wouldn't consider it as a
security breach because it does require user name and password.

Thanks
Hank

Ben Finney <bi****************@and-benfinney-does-too.id.au> wrote in message news:<sl*******************************@rose.local domain.fake>...
On Thu, 12 Feb 2004 00:29:42 -0000, Cameron Laird wrote:
I believe soundwave56 is focused on Windows hosts. There, the correct
initial answer to, "how would I execute a file remotely?" is, through
a security breach.


No, the correct answer (on any operating system) is "through a
remote-execution facility". "Security breach" is dependent on the
security policy in place; remote execution can be a perfectly
permissible operation, or a serious breach of security, depending on
the specific circumstances and what the security policy allows.
That's a serious answer. Operating systems are not *supposed* to
allow "outsiders" to execute processes.


Utter rot. Operating systems are supposed to do what the person owning
the hardware tells them to do.

Whether "outsiders" are allowed to execute programs on the operating
system is entirely dependent on how you define "outsiders". Some
operating systems are designed to treat remote users and local users
identically; on such systems, "outsider" is not a function of "remote or
local", but rather "permitted or not permitted".

On other operating systems, multiple-user and networking is a bolt-on
afterthought, and an unnecessary line is drawn between local and remote
users. The availability of smooth, simple remote-execution facilities
on such operating systems will likely be poor.

Jul 18 '05 #5

P: n/a
On 12 Feb 2004 14:46:54 -0800, Hank <so*********@yahoo.ca> wrote:
This is strictly for automated software testing on windows. Test
scripts on one machine, application under test on another machine.
This is why i need to run files remotely.

I couldn't find any specific python code that would do the job, so I
just use PsExec from www.sysinternals.com. I wouldn't consider it as a
security breach because it does require user name and password.


In that case you'd be better off with a good port of ssh, which encrypts
passwords and traffic (although it probably doesn't matter much if both
machines are on a LAN where lots of Windows passwords already travel in the
clear).

/Jorgen

--
// Jorgen Grahn <jgrahn@ ''If All Men Were Brothers,
\X/ algonet.se> Would You Let One Marry Your Sister?''
Jul 18 '05 #6

P: n/a
> In that case you'd be better off with a good port of ssh, which encrypts
passwords and traffic (although it probably doesn't matter much if both
machines are on a LAN where lots of Windows passwords already travel in the
clear).


NTLM and NT hashes are not plaintext, even though there are well
documented brute-force attacks against those hashes.

On the other hand, many web pages (or POP3, IMAP, FTP, etc.) still
prefer to authenticate users using plain or base64 encoded passwords,
without ssl. This is a bigger security hole than NTLM or NT hashes by a
long shot.

- Josiah
Jul 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.