使用java将本地文件复制并执行到Windows和Linux的远程服务器
我试图做的是使用 java 将多个文件从一台主机复制到远程服务器,并在复制完成后,我将执行我传输的那些文件。主机可能有一些依赖项,例如需要腻子或其他一些程序,但我希望可能有一个不需要在远程端安装任何东西的解决方案。最重要的是,这需要独立于操作系统,尽管不同的方法可以用于不同的通信。我将有权访问 IP 地址和管理控制(root 用户名和密码)。
到目前为止,我所拥有的是,对于 Windows 到 Windows,我可以安装远程 Windows 驱动器并以这种方式访问文件。在 Windows 到 Linux 中,我可以使用 putty 或类似的程序通过 ssh 进入远程盒子。我还将通过 ssh 从 Linux 到 Linux,显然我不需要 putty。我不知道如何处理 Linux 到 Windows 的实例,不需要我在远程端设置一些 ssh 方法。有什么想法吗?有什么方法(或库)来执行复制和/或执行方法,甚至不特定于操作系统?
What I'm attempting to do is copy a number of files from one host machine to a remote server using java and after the copy is made, I'll execute those files that I transferred. The host machine may have some dependencies like requiring putty or some other program but I'm hoping that there might be a solution that doesn't require anything installed on the remote side. And on top of that, this needs to be OS independent, though different methods can be used for different communications. I'll have access to the IP address and admin control (root username and password).
What I've had so far was that for Windows to Windows, I can mount the remote windows drive and access the files that way. In Windows to Linux, I can use putty or a similar program to ssh into the remote box. I'll also ssh from Linux to Linux and obviously I won't need putty. I can't figure out what to do for a Linux to Windows instance that won't require me setting up some ssh method on the remote end. Any ideas? Any way (or library) to perform both the copy and/or execute methods that won't even be OS specific?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个简单的解决方案是使用 Windows 已经提供的: rdesktop 或更舒适的 终端服务器客户端(如果您使用的是 Gnome 计算机)。
要将文件传输到 Windows 机器,您可以在 Linux 计算机上设置 Samba 客户端并安装 Windows 文件共享,将文件复制到那里,通过 rdesktop 连接,然后执行它们。
A simple solution is to use what Windows already offers: rdesktop or the more comfortable Terminal Server Client if you are on a Gnome machine.
To get the files to the Windows box, you can set up Samba Client on your Linux machine and mount the Windows file share, copy your files there, connect via rdesktop and then execute them.