Пример #1
0
        /// <exception cref="Com.Jcraft.Jsch.JSchException"/>
        private Session CreateSession(string host, SshFenceByTcpPort.Args args)
        {
            JSch jsch = new JSch();

            foreach (string keyFile in GetKeyFiles())
            {
                jsch.AddIdentity(keyFile);
            }
            JSch.SetLogger(new SshFenceByTcpPort.LogAdapter());
            Session session = jsch.GetSession(args.user, host, args.sshPort);

            session.SetConfig("StrictHostKeyChecking", "no");
            return(session);
        }