0

我的来源在下面

<%@ page language="java"
import= "java.io.*,java.util.*" 
contentType="text/html;charset=EUC-KR" session="false" 
%>

<html>
<%  
try{
Process ps = null;

ps = Runtime.getRuntime().exec(new String[]{"su","ec2-user"});
ps.waitFor();

ps = Runtime.getRuntime().exec(new String[]{"cd"});
ps.waitFor();

ps = Runtime.getRuntime().exec(new String[]{"mkdir","/home/ec2-user/hello"});
ps.waitFor();

}catch(IOException ie){
  ie.printStackTrace();
}catch(Exception e){
  e.printStackTrace();
}
%>
</html>

执行时,页面无限加载。

为什么不能使用这个命令?

ps = Runtime.getRuntime().exec(new String[]{"su","ec2-user"});

4

1 回答 1

0

Just a shot in the dark: Maybe su is waiting for a password.

于 2013-08-29T21:12:33.803 回答