需要使用process.exec("passwd user");
需要输入新密码、确认新密码
怎么知道什么时候输入新密码、怎么输入新密码呢

解决方案 »

  1.   

    关键是从process.getInputStream()中读不到提示信息,如:
    输入新密码:Changing password for user tgw.
               New UNIX password: *******
    确认新密码:Retype new UNIX password: ********而且往process.getOutputStream()里面写入密码也没有反应
      

  2.   

    取得输出流后,我是往输出流PrintWriter pw = new PrintWriter(outStream, true);
    pw.println("xxxxxxxxx");
    没反应的
      

  3.   

    1.你是否flush了?
    2.运行其他的命令有问题么?还是说只有输入密码的时候不行?
    3.ssh登录unix操作么?