비밀번호가 설정되지 않은 경우 SSH에는 공개 키 비밀번호가 필요합니다.

비밀번호가 설정되지 않은 경우 SSH에는 공개 키 비밀번호가 필요합니다.

한동안 내 서버에서 공개 키 인증을 사용해 왔지만 연결을 시도하는 새 "클라이언트"에 문제가 있습니다.깃허브. 내 권한이 올바르게 설정되었는지 확인하고 github에 대한 새 키를 생성했는지 확인하기 위해 많은 스레드를 읽었습니다. 내가 직면한 문제는 ssh에서 비밀번호를 설정하지 않았음에도 비밀번호를 입력해야 한다는 것입니다. 비밀번호를 입력하지 않았음을 100% 확신하기 위해 키를 다시 만들었습니다.

SSH-vvv다음과 같은 관련 출력을 제공합니다.

debug1: Offering public key: /home/me/.ssh/github.pub
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1495
debug1: Remote: Forced command: gerve mygithubusername c3:71:db:34:98:30:6d:c2:ca:d9:51:a8:c6:1b:fc:f7
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp c3:71:db:34:98:30:6d:c2:ca:d9:51:a8:c6:1b:fc:f7
debug3: sign_and_send_pubkey
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/me/.ssh/github.pub': 

왜 그런 말을 하는지 찾아봤는데PEM_read_PrivateKey실패했지만 해결책을 찾을 수 없습니다.

나는 프록시 등을 사용하지 않습니다. ~/.ssh/config 파일을 다음과 비슷하게 구성했습니다.

Host github
Host github.com
Hostname github.com
User git
PubkeyAuthentication yes
IdentityFile /home/me/.ssh/github.pub

미리 감사드립니다.

답변1

IdentityFileoptions 를 사용하면 ~/.ssh/config비공개를 가리키게 됩니다.대중이 아니라, 열쇠.

에서 man ssh_config:

신분증
사용자의 DSA, ECDSA 또는 DSA 인증 ID를 읽는 파일을 지정합니다. 프로토콜 버전 1의 기본값은 ~/.ssh/identity이고, 프로토콜 버전 2의 기본값은 ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_rsa입니다.

따라서 ~/.ssh/config항목은 다음과 같아야 합니다.

Host github.com
Hostname github.com
User git
PubkeyAuthentication yes
IdentityFile /home/me/.ssh/github

답변2

이 문제가 발생했는데 잘라내기 및 붙여넣기 오류였습니다. %키 파일 끝에 기호가 추가됩니다(따라서 마지막 줄 -----END RSA PRIVATE KEY-----%). 오류나 디버그 메시지 또는 키 길이가 잘못되었거나 형식이 잘못되었음을 나타내는 다른 내용은 없지만 ssh는 비밀번호를 묻습니다.

답변3

제 경우에는 SSH 클라이언트가 ED25519 키를 지원하지 않는다는 것이 문제였습니다. 해결책은 RSA 키를 생성하여 사용하는 것입니다.

이 문제는 다음에서 발생합니다.OpenSSH < 6.5(실행 ssh -V) 및퍼티 < 0.68.

이는 다음 출력에서 ​​확인할 수 있습니다 ssh -vvv.

debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,[email protected]
debug2: kex_parse_kexinit: hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96
debug2: kex_parse_kexinit: hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]

이것첫 번째 블록은 클라이언트가 지원하는 것을 설명하고, 두 번째 블록은 서버가 지원하는 것을 설명합니다.. 보시다시피 상단에 "curve25519"라는 언급이 없어 클라이언트가 이를 지원하지 않음을 나타냅니다.

답변4

우리 팀에서는 이런 일이 발생하면 로컬 문제가 문제가 되지 않습니다. 사용자의 SSH 키 및/또는 액세스 권한이 연결된 서버(이 경우 호스팅 플랫폼)에서 올바르게 구성되지 않았습니다. 어떤 이유로 존재하지 않는 SSH 키에 대한 프롬프트가 표시됩니다.

관련 정보