通过 SSH 连接的 Ant SCP 任务
我希望能够将我的应用程序传输到开发服务器,但为了访问它,我首先必须 ssh 到 SSH 网关,然后 ssh 到内部网络到相应的服务器。我可以使用 WinSCP 使用隧道选项来执行此操作,我知道 ant 支持 SCP 任务,但它是否支持通过另一个 ssh 连接来实现?
I want to be able to transfer my application to the development server but in order to access it I first have to ssh to an SSH gateway and then ssh into the internal network to the appropriate server. I can do this with WinSCP using the Tunnel option, I know that ant supports SCP tasks but does it support it over another ssh connection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有点丑陋的建议,但是您可以使用 scp 任务将应用程序部署到网关,然后使用 sshexec 任务在网关上运行脚本,将应用程序 scp 到下一个服务器吗?
Kind of an ugly suggestion, but could you use the scp task to get your app deployed to the gateway and then use the sshexec task to run a script on the gateway to scp your application to the next server?
尽管这个问题并不新鲜,但我今天发现自己也遇到了类似的情况。我的目标是在必须通过隧道(通过另一台服务器)到达的远程服务器上上传文件并运行命令。 这可以通过 ant 实现!
sshsession
仅创建一个可用于执行其中任务的隧道。其中的任务不会自动在远程服务器上运行,但您可以将sshexec
任务与 tunnel 一起使用来实现这一点。此外,scp
任务现在可以通过隧道上传到远程服务器。这是一个例子:Although this question is not exactly new, I found myself in a similar situation today. My goal is to upload files and run commands on a remote server to which I have to tunnel (through another server). And it is possible with ant!
The
sshsession
only creates a tunnel that you can use for the tasks within. The tasks within are not automatically run on the remote server but you can use thesshexec
task together with the tunnel to achieve that. Also thescp
task can now upload through the tunnel to the remote server. Here is an example: