Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 need to automate the following workflow.

  1. Copying a file (say inputfile.txt) to a remote machine (fixed ip) through SSH

  2. Logging into that remote machine through SSH (using Remote Desktop Viewer of ubuntu)

  3. Running a particular command with that file (inputfile.txt) as parameter.

    mycommand -option inputfile.txt

I need to be able to right click the file and choose "Execute my mycommand" context menu (Nautilus) item which will run the command in the remote machine. (and hopefully show a message box with the result - not that necessary)

Need suggestions on how to do it.

EDIT: Figured out copy works this way. Any idea on how to integrate into nautilus menu. Also the following command prompts for password

scp -r inputfile.txt user@machine.domain:/home/userremote/Documents

share|improve this question
Do you truly need to run the command using remote desktop? It would e far easier if you could execute the command over SSH, possibly using X forwarding if it's truly a GUI application. – Flimzy Jul 12 '11 at 3:47

GUI-Programs aren't always easily automated.

The first challenge is the nautilus-script.
What does it contain?

cat ~/.gnome2/nautilus-scripts/mycommand

Maybe you can do it in a more direct way.

cat inputfile.txt | ssh REMOTE "mycommand"


cat inputfile.txt | ssh REMOTE "cat - > tmp.txt; ~/.gnome2/nautilus-scripts/mycommand -option tmp.txt"

or with two commands, scp first.

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.