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 に答える