Example #1
0
        /// <summary>
        /// 通过密码建立SFTP连接
        /// </summary>
        private void ConnectSFTPByPassword()
        {
            try
            {
                JSch JSchModel         = new JSch();
                SFTPUserInfoModel User = new SFTPUserInfoModel();
                _session = JSchModel.getSession(_userName, _hostName, _port);
                _session.setPassword(_password);
                User.setPassword(_password);
                _session.setUserInfo(User);

                CreateConnectSFTP();
            }
            catch (Exception e)
            {
                _log.Warn("通过密码建立SFTP连接失败!", e);
            }
        }