日期:2014-05-16  浏览次数:20993 次

help!!! ssh使用privatekey连接问题
我使用ganymed-ssh2-build210.jar包通过scp命令发送文件,连接的程序如下:

      private   Connection   getOpenedConnection(String   host,   String   username,  
                  String   password   )   throws   IOException
      {
            Connection   conn   =   new   Connection(host);
            conn.connect();   //   make   sure   the   connection   is   opened


            boolean   isAuthenticated   =   conn.authenticateWithPublicKey(username,   new   File( "C:\\ssh\\id_rsa "),   null);

            if   (isAuthenticated   ==   false)
            {
                  throw   new   IOException( "Authentication   failed. ");
            }
            return   conn;
      }


得到的异常是java.io.IOException:   Publickey   authentication   failed.


这里的PublicKey生成过程应该怎样生成,我的发送方是windows,接收文件方是unix,这里的rsa   key   pair应该怎样生成?应该是在unix(文件接收方)生成key   pair还是在windows(文件发送方)?

------解决方案--------------------
因为是普通文本,所以Linux和Windows下生成都可以
------解决方案--------------------
up
------解决方案--------------------
UP
------解决方案--------------------
JF
------解决方案--------------------
JF

------解决方案--------------------
JF
------解决方案--------------------
jf
------解决方案--------------------
jf
------解决方案--------------------
JF
------解决方案--------------------
。。。楼上几个好无聊 这又不是散分帖