Изменить пароль UNIX с помощью JAVA [закрыто]

извините, если мой английский такой плохой. я хочу спросить об исполнении "ПАРОЛЬ» команда из Java (я использую Netbeans IDE & АКХ Библиотека)

Это мой код

String username = txtusername.getText();
    String password = txtpassword.getText();
    String ip = txtIP.getText();
    int port = 22;
    Session session = null;
    Session session2=null;
    ChannelExec channel = null;
    Channel channel2 = null;
    StringBuffer result = new StringBuffer();
    try
    {
        JSch shell = new JSch();
        session = shell.getSession(username, ip, port);
        java.util.Properties config = new java.util.Properties();
        config.put("StrictHostKeyChecking", "no");
        session.setConfig(config);
        session.setPassword(password);
        session.connect(3000);
        channel = (ChannelExec) session.openChannel("exec");
        ((ChannelExec)channel).setCommand("passwd");

        channel.setInputStream(null);
        channel.setOutputStream(null);
        ((ChannelExec)channel).setErrStream(System.err);

        InputStream in=channel.getInputStream();
        OutputStream out=channel.getOutputStream();

        PrintStream char_to_send_to_channel = new PrintStream(out,true);
        BufferedReader out_from_channel=new BufferedReader(new InputStreamReader(in));
        char_to_send_to_channel.println();

        String line;
        channel.connect();

        JOptionPane.showMessageDialog(null,"Channel opened!" +"\n");

       // Process p = Runtime.getRuntime().exec("passwd");

        byte[] tmp=new byte[1024];
        while(true){
          while(in.available()>0){
            int i=in.read(tmp, 0, 1024);
            if(i

Ответы на вопрос(1)

Ваш ответ на вопрос