2017-05-16 17 views
0

내가 사용하여 생성 DSA 키 파일을 사용하여 Cygwin에서 설치는 openssh 서버에 로그인하기 위해 노력하고있어 실패 쉿 DSA 키 인증

난을/etc/sshd_config에있는도 구성 SSH 서버 (다른 모든 기본적으로 주석 처리 된) :

PubkeyAuthentication yes 
AuthorizedKeysFile  .ssh/authorized_keys 
PasswordAuthentication yes 
PubkeyAcceptedKeyTypes=+ssh-dss 
,321 0에서의/etc/ssh_config를 (다른 모든 기본적으로 주석 처리 된) :

Host * 
PubkeyAcceptedKeyTypes=+ssh-dss 

를 이제 사용하여 로그인하려고하면

ssh -vvvv -i .ssh/id_dsa [email protected] 

을 나는 다음과 같은 한 :

OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017 
debug1: Reading configuration data /etc/ssh_config 
debug1: /etc/ssh_config line 20: Applying options for * 
debug2: resolving "localhost" port 22 
debug2: ssh_connect_direct: needpriv 0 
debug1: Connecting to localhost [::1] port 22. 
debug1: Connection established. 
debug1: identity file .ssh/id_dsa type 2 
debug1: key_load_public: No such file or directory 
debug1: identity file .ssh/id_dsa-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_7.5 
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5 
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000 
debug2: fd 3 setting O_NONBLOCK 
debug1: Authenticating to localhost:22 as 'ltonon' 
debug3: hostkeys_foreach: reading file "/home/ltonon/.ssh/known_hosts" 
debug3: record_hostkey: found key type ECDSA in file /home/ltonon/.ssh/known_hosts:1 
debug3: load_hostkeys: loaded 1 keys from localhost 
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 
debug3: send packet: type 20 
debug1: SSH2_MSG_KEXINIT sent 
debug3: receive packet: type 20 
debug1: SSH2_MSG_KEXINIT received 
debug2: local client KEXINIT proposal 
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c 
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa 
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc 
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc 
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 
debug2: compression ctos: none,[email protected],zlib 
debug2: compression stoc: none,[email protected],zlib 
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal 
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1 
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] 
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] 
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 
debug2: compression ctos: none,[email protected] 
debug2: compression stoc: none,[email protected] 
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256 
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none 
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none 
debug3: send packet: type 30 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug3: receive packet: type 31 
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:3kIsOo83GqltRfLJY2uSGhsQZDVcY+BoTgl+YqvWYns 
debug3: hostkeys_foreach: reading file "/home/ltonon/.ssh/known_hosts" 
debug3: record_hostkey: found key type ECDSA in file /home/ltonon/.ssh/known_hosts:1 
debug3: load_hostkeys: loaded 1 keys from localhost 
debug1: Host 'localhost' is known and matches the ECDSA host key. 
debug1: Found key in /home/ltonon/.ssh/known_hosts:1 
debug3: send packet: type 21 
debug2: set_newkeys: mode 1 
debug1: rekey after 134217728 blocks 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug3: receive packet: type 21 
debug1: SSH2_MSG_NEWKEYS received 
debug2: set_newkeys: mode 0 
debug1: rekey after 134217728 blocks 
debug2: key: .ssh/id_dsa (0x60005ff20), explicit 
debug3: send packet: type 5 
debug3: receive packet: type 7 
debug1: SSH2_MSG_EXT_INFO received 
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> 
debug3: receive packet: type 6 
debug2: service_accept: ssh-userauth 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug3: send packet: type 50 
debug3: receive packet: type 51 
debug1: Authentications that can continue: publickey,password,keyboard-interactive 
debug3: start over, passed a different list publickey,password,keyboard-interactive 
debug3: preferred publickey,keyboard-interactive,password 
debug3: authmethod_lookup publickey 
debug3: remaining preferred: keyboard-interactive,password 
debug3: authmethod_is_enabled publickey 
debug1: Next authentication method: publickey 
debug1: Offering DSA public key: .ssh/id_dsa 
debug3: send_pubkey_test 
debug3: send packet: type 50 
debug2: we sent a publickey packet, wait for reply 
Authentication failed. 

내가 여기에서 길을 잃었다. .. 내가 놓쳤던 것을 확인하는 것을 도울 수 있냐?

감사 클라이언트가 올바르게 구성되어 많은

답변

0

- 키가 성공적으로 시도됩니다 :

debug1: Offering DSA public key: .ssh/id_dsa 
debug3: send_pubkey_test 
debug3: send packet: type 50 
debug2: we sent a publickey packet, wait for reply 

하지만 키가 서버에 의해 거부됩니다. 파일 ~/.ssh/authorized_keys이 서버에 있고 올바른 사용 권한 (및 상위 디렉토리)이 있는지 확인하고 구성을 변경 한 후 서버에서 sshd 서비스를 다시 시작했는지 확인하십시오.

sshd_config을 열어 LogLevel DEBUG3을 입력하고 sshd 서비스를 다시 시작한 다음 다시 한 번 연결을 시도하고 로그를 살펴보십시오.

하지만 실제로는 DSA 키를 사용하지 않아야합니다!

+0

안녕하세요 Jakuje, 답장을 보내 주셔서 감사합니다. 나는 당신이 추천 한 것을했지만 여전히 성공을 거두지 못했습니다. 너 무슨 얘기 야? 나는 /var/log/sshd.log에 갔다. 그리고 그것은 비어있다. 어딘가에있을거야? 권한에 관해서는 "chmod 777 .ssh"로 시도했지만 여전히 같은 오류가 발생했습니다. 또한 키 확인을 시도했습니다. ssh-keygen -i -f /home/ltonon/.ssh/id_dsa 및 "got blob failed : invalid format" –

+0

생각없이'chmod 777'을 사용하지 마십시오. 이제까지! https://www.nixcraft.com/cms/wp-content/uploads/2017/05/chown-chmod-2.png 해당 디렉토리에 대한 권한은 700이어야합니다. 그렇지 않으면 누구나 자신의 공개 키를 홈 디렉토리에 기록하고 액세스 할 수 있습니다 너의 기계! – Jakuje

+0

예 예 알아 두었습니다 : 여기 테스트를 위해서입니다. 나는 또한 RSA 키를 사용해 보았는데 같은 문제가있다. 실마리가 있습니까? 다시 여기서 cygwin을 사용하고 있습니다. 내가 일하고 있어요 및 키를 사용하여 ssh 서버에 연결하는 오래된 응용 프로그램 (그 이유는 "신속하게"내 로컬 컴퓨터에서 ssh 서버를 설치하려면) –