Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a python script ( which collects information about a machine and prints the output at the end.

Along the way it asks for user input (using Pythons' raw_input functionality).

Is there a way to run this script on a remote machine, saving the output to a local file?

share|improve this question

Assuming both servers are some sort of *nix install, have ssh keys set up for password-less logins, and the remote server has python.

Copy the script to the remote server:

scp serveraddress:~

Run the script on the remote machine, and save the output to a local file:

ssh serveraddress "./" >outputfile

If you are running it as a script, send it the input it needs:

cat input_for_auditpy | ssh serveraddress "./" >outputfile
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.