473,568 Members | 2,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Executing a file remotely

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
6 5080
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@remotes erver '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
In article <sl************ *************** ****@rose.local domain.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@remotes erver '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
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
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. localdomain.fak e>...
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
On 12 Feb 2004 14:46:54 -0800, Hank <so*********@ya hoo.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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
27468
by: Sean | last post by:
I can connect to a machine remotely with no problems but I'm having trouble trying to create a process remotely. Initially this was a perl and VB script which I'm converting to python. Its entire purpose is to start a process remotely. The problem initially was that the perl script could not 'see' any mapped drives as it would alway return...
7
2522
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with Server.Execute? Specifically for me it simply is not executing ... the server does not transfer to the page specified. The calling ASP just continues as if it had gone to the page and returned ... with no error code. This ASP had been working actually. I made a change to a <FORM>...
3
7013
by: Greg D. Moore \(Strider\) | last post by:
Ok, I thought this one would be easy. I have a stored proc: master.dbo.restore_database_foo This is on database server B. Database server A backs up database foo on a daily basis as a scheduled task. What I wanted to do was, at the end of the scheduled task is then call the
6
3991
by: Pat Carden | last post by:
Hi, We need to allow webusers to upload a file on our website (on Server3, all servers run Server 2003, remotely hosted) and eventually save it on our SBS Server (Server2) which is not exposed through our firewall. We have another server (Server1) within the SBS domain that is exposed through port 80 of the firewall on which we host some...
3
1497
by: Eva | last post by:
Hi All Is it possible to connect to a remote machine running a vb.net application, access the C drive on the remote machine and execute an exe from the server programatically Eva
3
2129
by: moxie | last post by:
I am trying to rsh from a server that does not have python installed to a server that has python but I get error message rsh python-server "/usr/local/bin/python /home/s/src/utpython/UnitTrip.py" Traceback (most recent call last): File "/home/s/src/utpython/UnitTrip.py", line 66, in ? import wx ImportError: No module named wx Then...
7
10134
by: Ctal | last post by:
What is the best way to have my windows app run a .bat file on a remote server? The .bat will need to run as an admin on the remote machine. Additonally I need for my windows app to wait for the .bat to finish.
1
1469
by: natsran | last post by:
Hi All, Is there any perl module which would help in executing commands remotely on a windows machine? For doing the same on unix machine, I found that we could use Net::Telnet module. But again one limitation of Net::Telnet module is that it fails to communicate with linux machines. Thanks in Advance, Natasha
2
4668
by: ashutoshrawat | last post by:
Hi I had 2 AIX system.i want to run a shell script on one machine, which will execute another shell script on another AIX machne. the 2nd remotely executed shell script will execute a java programe on 2nd AIX machine i had gone on some similar thread in this forum.... which includes ssh http://bytes.com/forum/thread579549.html
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.