与蚂蚁的Ssh隧道

时间:2017-04-12 11:05:13

标签: ssh ant ssh-tunnel

我需要从本地计算机连接到远程主机上的websphere服务器。 我用ant来创建ssh会话和本地隧道。当我在下面执行这个目标时,连接到主机:" somehost"已成功但与targetHost的连接失败。有人可以帮帮我吗?我需要连接到" targetHost" througt" somehost"。

我为此连接所做的目标是:

<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 个答案:

答案 0 :(得分:1)

我解决了我的问题,所以如果有人遇到同样的问题,你需要添加的唯一内容是sshexec标签中的trust属性并将其设置为true。