LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Invoking a shell script remotely. (https://www.linuxquestions.org/questions/linux-newbie-8/invoking-a-shell-script-remotely-590839/)

niks27 10-10-2007 12:42 PM

Invoking a shell script remotely.
 
Scenario:

From my ANT build script on Windows machine, I'm trying to invoke a shell script on VMWare installed on the same build machine. The part ANT script and the shell script are pasted below;

ANT Script: (build.xml)
-----------

<target name="build">
<echo>username=${username}</echo>
<echo>password=${password}</echo>
<echo>cmd /C ${cygwin}</echo>
<echo message="Starting the SSHEXEC operation for using connect script"/>
<sshexec host="vm"
username="${username}"
Password="${password}"
trust="true"
command="/home/username/build/build.sh"/>
<echo message="Ending the SSHEXEC operation for using connect script"/>
</target>

Shell Script: (build.sh)
-------------
echo hello>text.txt
ssh-add /home/username/.ssh/dev_rsa| echo passphrase
ssh-agent
cd /home/username/build/application
echo up..
svn update
echo up..
cd ~

The Problem

I'm able to connect the VMWare box and execute other commands like, ifconfig on it. But this shell script requires passphrase for svn. I tried to pipe it in too but no success. Can someone help how can I modify the call from build script or modify the shell script so that when I try to connect svn I should be able to provide the passphrase or the shell script will by itself take care of the passphrase.

Let me know if you need further explnation on the issue.

Any help is highly appreciated.

regards
niks...

miedward 10-11-2007 07:22 AM

Its hard to do because you're not really supposed to do it that way :)

Or at least thats what I read when I was trying to do something similar.

Could you set up public/private keys and do passwordless authentication?

That is much easier to script, though it is "riskier" since it links the two machines quite closely. But a) its a VM so if the server is compromised they have "physical access" to the VM anyway and b) you are saving ssh-keys unencrypted the way you are doing it now anyway, so this is probably more secure.


All times are GMT -5. The time now is 01:32 PM.