从 Windows 计算机远程运行 Linux 上的进程
我希望能够从 Windows 计算机上运行的 JAVA 应用程序远程运行 Linux 计算机上存在的进程。最好的方法是什么?或者可能对我有帮助的在线资源?非常感谢。
I would like to be able to run a process that exists on a Linux machine remotely from a JAVA application running on a Windows machine. What is the best way to do this? Or an online resource that might be of help to me? Thanks very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用许多 Java SSH 客户端库中的任何一个,例如 javassh,只要 Linux机器运行 sshd (并且防火墙都设置为让 ssh 流量通过),这很可能是这种情况。有许多可能的方法来配置 ssh 身份验证,基本上可以归结为在网络上(安全地)发送密码,或使用公钥/私钥对(RSA 或 DSA)——后者通常更可取,但您需要请向系统和网络管理员咨询此问题...这实际上并不是软件开发问题,而是与系统管理和安全相关的问题。
You could use any of the many Java SSH client libraries, such as javassh, as long as the Linux machine runs an sshd (and the firewalls are all set to let ssh traffic through), which is likely to be the case. There are many possible ways to configure ssh authentication, basically boiling down to either sending password (securely) on the net, or using public/private key pairs (RSA or DSA) -- the latter is generally preferable, but you'll need to check with system and network administrators about this issue... it's not really a software development issue, but rather one related to system administration and security.
简而言之,使用 ssh 客户端。
选项 1:在 Cygwin 中安装 openssh 软件包。
选项 2:使用 Putty。
在任何一种情况下,您都可以设置密钥对以允许自动(非密码)身份验证。
In short, use an ssh client.
Option 1: Install openssh package in Cygwin.
Option 2: Use Putty.
In either case, you can setup a keypair to allow for automatic (non-password) authentication.
您还可以创建一种客户端/服务器架构。您的 Java 客户端将向您的 Java 服务器(~ webservice)发送一条命令,该命令将执行所需的进程。
但显然,这取决于您的目标。
您需要以安全的方式做到这一点吗?
是通过互联网还是在本地网络内?
最后,该进程是 Java 进程吗?
You can also make a kind of client/server architecture. Your Java client will send a command to your Java server (~ webservice), that will execute the desired process.
But obviously, it depends on your aims.
Do you need to do that in a secure way?
Is it through the internet or inside a local network?
And finally, is the process a Java process?
您可以使用 ssh 命令登录系统
例子..
You can use ssh command to login into a sytem
example..