ITeye博客

ssh

共 1 篇文章

纯Java通过SSH执行Linux命令的方法及代码

转自: http://ilexes.blog.51cto.com/705330/531352 注:此ssh非彼SSH(Struts+Spring+Hibernate) 在Java中,我们可以通过Runtime去执行一些OS的命令,如: String[] shell = new String[] { " /bin/sh " , " -c " , " ls -l " } ; Process p = Runtime.getRuntime().exec(shell); 通过在Linux上执行 ssh --help命令, usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-…

2011-08-22 17:12 · ssh