Executing a file remotely

B

Ben Finney

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>
 
H

Hank

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
 
C

Cameron Laird

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 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.

That's a serious answer. Operating systems are not *supposed* to
allow "outsiders" to execute processes.

There are, of course, plenty of more-or-less legitimate reasons
you might need to execute remote processes. At a minimum (again,
assuming you don't exploit holes in Windows), you'll need to
configure the remote host ahead of time in one of several ways
which provide for remote process launching. Which of those
several ways should you choose? It depends. At this point, it
might help to understand your larger goals. Is this really about
file backup, or inventory management, or network administration,
or ...?
 
B

Ben Finney

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.
 
H

Hank

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
 
J

Jorgen Grahn

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
 
J

Josiah Carlson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top