2017-04-12 140 views
0

我需要從本地計算機連接到遠程主機上的websphere服務器。 我已經使用ant創建SSH會話和本地隧道。當我在下面執行這個目標時,連接到主機:「somehost」成功,但連接到targetHost失敗。有人可以幫幫我嗎?我需要通過「某個主機」連接到「targetHost」。Ssh使用螞蟻隧道

我對於這方面提出的目標是:

<target name="connect-to-websphere"> 
    <taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec"> 
     <classpath refid="build.classpath.jar"/> 
    </taskdef> 
    <taskdef name="sshsession" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHSession"> 
     <classpath refid="build.classpath.jar"/> 
    </taskdef> 
    <sshsession host="somehost" 
       username="user" 
       password="pass" 
       port="22"> 
     <localtunnel lport="3000" rhost="targetHostWhereIsWebsphere" rport="22"/> 
     <sequential> 
      <sshexec host="localhost" 
        username="userFortargetHost" 
        password="passwordFortargetHost" 
        port="3000" 
        command="dummy command;"> 
      </sshexec> 
     </sequential> 
    </sshsession> 
</target> 

回答

1

我解決我的問題,因此,如果任何人都會有同樣的問題,你需要添加的唯一事情是在sshexec標籤信任屬性和設置真正。