2014-02-16 2 views
1

각기 다른 키 쌍이있는 두 개의 리모컨을 사용하도록 ssh를 구성하려고합니다. 따라서 나는 config을 만들었습니다.OpenSSH가 잘못된 공개 키를 제공합니까?

UserKnownHostsFile ~/.ssh/known_hosts 

Host github.com 
    User git 
    PreferredAuthentications publickey 
    IdentityFile ~/.ssh/github_rsa 

Host git.cloudhost.io 
    User git 
    PreferredAuthentications publickey 
    IdentityFile ~/.ssh/cloudhost 

Github에 연결하면 정상적으로 작동합니다.

> ssh -T github.com 
Hi danijar! You've successfully authenticated, but GitHub does not provide shell 
access. 

하지만 Cloudhost의 경우 연결이 실패합니다.

> ssh -T git.cloudhost.io 
Permission denied (publickey,password). 

다음은 Cloudhost의 디버그 출력입니다. cloudhost 개인 키 때문에

> ssh -v git.cloudhost.io 
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 
debug1: Reading configuration data /c/Users/Name/.ssh/config 
debug1: Applying options for git.cloudhost.io 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug1: Connecting to git.cloudhost.io [31.220.27.160] port 22. 
debug1: Connection established. 
debug1: identity file /c/Users/Name/.ssh/cloudhost type 1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1p1 Debian-4 
debug1: match: OpenSSH_6.1p1 Debian-4 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_4.6 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-cbc hmac-md5 none 
debug1: kex: client->server aes128-cbc hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host 'git.cloudhost.io' is known and matches the RSA host key. 
debug1: Found key in /c/Users/Name/.ssh/known_hosts:1 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Offering public key: C:\\Users\\Name\\.ssh\\github_rsa 
debug1: Authentications that can continue: publickey,password 
debug1: Offering public key: C:\\Users\\Name\\.ssh\\github_rsa 
debug1: Authentications that can continue: publickey,password 
debug1: Offering public key: /c/Users/Name/.ssh/cloudhost 
debug1: Authentications that can continue: publickey,password 
debug1: No more authentication methods to try. 
Permission denied (publickey,password). 

라인 Offering public key: /c/Users/Name/.ssh/cloudhost은 나를 혼란. 공개 키는 cloudhost.pub입니다.

로그인 사용자로 ssh를 통해 Cloudhost에 어떻게 연결할 수 있습니까? 로그에서

+0

@ AD7six Windows 용 Github를 다시 설치 했으므로 Git을 다시 설치했습니다. 이제'git.cloudhost.io'에 대한 연결이'Permission denied (publickey, password) .'라는 메시지와 함께 실패합니다. 질문이 업데이트됩니다. – danijar

+0

출력은'/ c/Users/Name/.ssh/cloudhost'가 제공되고 거부됨을 나타냅니다. 특히 공개/비공개 언급에 비추어 볼 때 공개 키가 원격 위치에 있지 않은 것처럼 들리므로 cloudhost 키와 연결하는 데 실패합니다. – AD7six

+0

@ AD7six 공용 키가 리모컨에 추가되었는지 다시 한 번 확인했습니다. [this answer] (http://stackoverflow.com/a/8755199/1079110)에 표시된 것처럼'git config --global http.sslVerify false'를 실행하면, 개인 저장소를 복제하고 푸시 할 수 있습니다. Cloudhost 원격. – danijar

답변

2

:

debug1: Reading configuration data /c/Users/Name/.ssh/config 
debug1: Applying options for git.cloudhost.io 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 

이 올바른 설정 파일인가? 두 파일의 내용을 다시 확인하십시오.

또한 이것 좀 봐 :

debug1: Offering public key: C:\\Users\\Name\\.ssh\\github_rsa 
debug1: Server accepts key: pkalg ssh-rsa blen 277 
debug1: Authentication succeeded (publickey). 

이 당신의 GitHub의 키를 제공하는 것처럼, 그것은 존재, 심지어 서버에 의해 받아 들여졌다 보인다.

파일이 존재하지 않습니까? 올바른 서버와 통신하고 있습니까? 서버에서 공개 키를 올바르게 구성 했습니까?

+0

답장을 보내 주셔서 감사합니다. 설정 파일은'C :/Users/Name/.ssh/config'입니다. Windows에서 두 번째 구성 경로는 어디에서 찾을 수 있습니까? 두 번째 작업에 대해 옳았습니다.이 명령을 실행 한 후'github_rsa' 키 쌍이'.ssh' 디렉토리에 자동으로 나타납니다. 아마도 이것은 Windows 클라이언트 용 Github와 함께 제공되는 Git 버전을 사용한다는 사실과 관련이 있습니다. 나는 아직도 Cloudhost 서버가'github_rsa' 키를 받아들이는 이유를 이해하지 못합니다. 키가 어떤 사용자와도 일치하지 않을 때 공개 액세스로 돌아가서 모든 키를 수락 할 수 있습니다. – danijar

+0

'키가 어떤 사용자와도 일치하지 않을 때 공개 액세스로 돌아가서 모든 키를 받아 들일 수 있습니다. '디버그 로그는 Cloudhost 키를 시도한 후에 받아 들인 github 키로 다시 떨어졌습니다. – AD7six

+0

@ AD7six 모든 로컬 저장소를 삭제하고 SSH를 통해 리모컨에서 다시 복제 한 후 마침내 작동했습니다. Windows 클라이언트 용 Github에서 커밋 할 수도 있습니다. – danijar

관련 문제