2012-09-07 5 views
1

여기 좀 새로 왔지만 코드에 도움이 필요합니다. .Svnkit + ssh 인증 오류 (E170001)

SVNRepositoryFactoryImpl.setup(); 

    SVNURL url = 
     SVNURL. 
      parseURIEncoded("svn+ssh://xxx"); 
    File keyFile = 
      new File("C://Users/xxxx/Documents/priave_key/private_key.ppk"); 
    System.out.println("PPK file space:"+keyFile.getTotalSpace()); 
    SVNSSHAuthentication sshCredentials = 
     new SVNSSHAuthentication(Settings.name, keyFile, Settings.pass, 22, false, url, false); 
    System.out.println(sshCredentials.getPrivateKey()==null); 
    System.out.println("hasPrivateKey(): "+sshCredentials.hasPrivateKey()); 
    SVNUserNameAuthentication authorNameCredentials = new SVNUserNameAuthentication(Settings.name, false); 
    SVNPasswordAuthentication passwordCredentials = new SVNPasswordAuthentication(Settings.name, Settings.pass, false); 

    ISVNAuthenticationManager authManager = 
     new BasicAuthenticationManager(new SVNAuthentication[] { 
        sshCredentials, 
        authorNameCredentials, 
        passwordCredentials}); 
    SVNRepository repository = SVNRepositoryFactory.create(url); 
    repository.setAuthenticationManager(authManager); 

    try { 

     SVNDirEntry info = repository.info("", -1); 
     System.out.println(info); 
    } finally { 
     repository.closeSession(); 
    } 

그래서이 프로그램을 실행 한 후 나는이 출력을 얻을 : 여기있다 나는 그것이 hasPrivateKey(에 대한 getPrivateKey()는 null 진정한 제공하기 때문에이 SVNSSHAuthentication 클래스에 문제가 될 수 있다고 생각

PPK file space:107374178304 
false 
hasPrivateKey(): true 
Exception in thread "main" org.tmatesoft.svn.core.SVNAuthenticationException: svn:  E170001: Authentication required for '[email protected]+ssh://xxx' 
    at  org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.jav a:47) 
    at  org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.jav a:41) 
    at 

org.tmatesoft.svn.core.auth.BasicAuthenticationManager.getNextAuthentication(BasicAuthentic ationManager.java:223) 
at  org.tmatesoft.svn.core.internal.io.svn.SVNSSHConnector.open(SVNSSHConnector.java:141) 
at org.tmatesoft.svn.core.internal.io.svn.SVNConnection.open(SVNConnection.java:77) 
at  org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.openConnection(SVNRepositoryImpl.j ava:1252) 
at  org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryImpl.info(SVNRepositoryImpl.java:1195) 
    at SVNTestNew.main(SVNTestNew.java:40) 

을) 또는 이것은 잘못된 생각입니까? 누구든지이 문제가 어떻게 해결 될 수 있는지 말해 줄 수 있습니까?

답변

0

내게 따르면 공개 키와 개인 키가 적절한 위치에 있지 않습니다.

${USER_HOME}/.ssh/abc.rsa or abc.dsa 

그리고 당신의 서버에서 공개 키를 저장해야합니다 :

기본 경로 : - : - 당신이 다음 리눅스 머신을 사용하는 경우

, 개인 키에 대한 당신은 기본 경로가

${USER_HOME}/.ssh/authorized_keys 

당신은 /etc/sshd_config file

에 경로를 변경할 수 있습니다