Package com.jcraft.jsch

Examples of com.jcraft.jsch.Session.openChannel()


                    session.setPassword(SFTPPASS);
                    java.util.Properties config = new java.util.Properties();
                    config.put("StrictHostKeyChecking", "no");
                    session.setConfig(config);
                    session.connect();
                    channel = session.openChannel("sftp");
                    channel.connect();
                    channelSftp = (ChannelSftp)channel;
                    channelSftp.cd(SFTPWORKINGDIR);
                    File ctl = new File(ctlfile.getPath());
                    channelSftp.put(new FileInputStream(ctl), ctl.getName());
View Full Code Here


                    session.setPassword(SFTPPASS);
                    java.util.Properties config = new java.util.Properties();
                    config.put("StrictHostKeyChecking", "no");
                    session.setConfig(config);
                    session.connect();
                    channel = session.openChannel("sftp");
                    channel.connect();
                    channelSftp = (ChannelSftp)channel;
                    channelSftp.cd(SFTPWORKINGDIR);
                    File ctl = new File(ctlfile.getPath());
                    channelSftp.put(new FileInputStream(ctl), ctl.getName());
View Full Code Here

                    session.setPassword(SFTPPASS);
                    java.util.Properties config = new java.util.Properties();
                    config.put("StrictHostKeyChecking", "no");
                    session.setConfig(config);
                    session.connect();
                    channel = session.openChannel("sftp");
                    channel.connect();
                    channelSftp = (ChannelSftp)channel;
                    channelSftp.cd(SFTPWORKINGDIR);
                    File ctl = new File(ctlfile.getPath());
                    channelSftp.put(new FileInputStream(ctl), ctl.getName());
View Full Code Here

        Session session = null;
        try {
            // execute the command
            session = openSession();
            session.setTimeout((int) maxwait);
            final ChannelExec channel = (ChannelExec) session.openChannel("exec");
            channel.setCommand(command);
            channel.setOutputStream(tee);
            channel.setExtOutputStream(tee);
            channel.connect();
View Full Code Here

       JSch jsch=new JSch()
       Session session=jsch.getSession(user, host, 22);
       UserInfo ui=new MyUserInfo();
       session.setUserInfo(ui);
       session.connect();
       Channel channel=session.openChannel("exec");
       ((ChannelExec)channel).setCommand(command);
//       channel.setInputStream(inputData);
//       channel.setOutputStream(outputData);
      
       channel.connect();
View Full Code Here

      session.connect();

      String command=JOptionPane.showInputDialog("Enter command",
                                                 "set|grep SSH");

      Channel channel=session.openChannel("exec");
      ((ChannelExec)channel).setCommand(command);

      // X Forwarding
      // channel.setXForwarding(true);
View Full Code Here

        Session session = getSession(pathOrUri);
        String host = session.getHost();
        ChannelSftp channel = SshCache.getInstance().getChannelSftp(session);
        if (channel == null) {
            try {
                channel = (ChannelSftp) session.openChannel("sftp");
                channel.connect();
                Message.verbose(":: SFTP :: connected to " + host + "!");
                SshCache.getInstance().attachChannelSftp(session, channel);
            } catch (JSchException e) {
                IOException ex = new IOException(e.getMessage());
View Full Code Here

    final JSch jsch = new JSch();
    final Profile.SSH x = box.getProfile().getSSH();
    final Session session = jsch.getSession(x.getAuth().getUsername(), x.getHostname(), x.getPort());
    session.setUserInfo(new PresetUserInfo(x.getAuth().getPassword(), null));
    session.connect(30000);
    final Channel channel=session.openChannel("shell");
    channel.setInputStream(System.in);
    channel.setOutputStream(System.out);
    channel.connect(3000);
    try {
      while (channel.isConnected()) {
View Full Code Here

            String command = execCommand.toString();
            LOGGER.info("Exec " + command);

            // Open an execution channel that supports SSH agent forwarding
            Channel channel = sess.openChannel("exec");
            ((ChannelExec) channel).setCommand(command);
            channel.connect();

            // Wait for the channel to close
            while (true) {
View Full Code Here

            channel.disconnect();

            // Execute the slave.jar to establish a connection
            // Make sure to enable SSH agent forwarding
            logger.println("Executing slave jar to make connection...");
            final Channel slaveChannel = sess.openChannel("exec");
            String sshWrapperPath = "/usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh";
            ((ChannelExec) slaveChannel).setEnv("GIT_SSH", sshWrapperPath);
            ((ChannelExec) slaveChannel).setAgentForwarding(true);
            String jarCachePath=System.getenv("JENKINS_JAR_CACHE_PATH");
            if (jarCachePath==null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.