![CentOS 7에서 비밀번호 없는 SSH가 작동하지 않습니다.](https://linux55.com/image/94873/CentOS%207%EC%97%90%EC%84%9C%20%EB%B9%84%EB%B0%80%EB%B2%88%ED%98%B8%20%EC%97%86%EB%8A%94%20SSH%EA%B0%80%20%EC%9E%91%EB%8F%99%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
VMWare에 설치된 CentOS7에서 비밀번호 없는 SSH를 시도하고 있습니다. 나는 이 단계를 따른다협회, 그러나 SSH를 사용할 때 문제가 발생했습니다. 로그는 다음과 같습니다.
[root@osboxes ~]# ssh root@localhost
root@localhost's password:
Last login: Wed Sep 21 16:02:39 2016 from localhost.localdomain
[root@osboxes ~]# ssh -v root@localhost
OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.4
debug1: match: OpenSSH_6.4 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 1b:08:56:1a:03:c6:e9:1d:dd:bf:19:02:72:c0:1b:0f
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Next authentication method: password
root@localhost's password:
또한 파일 권한은
- ls -lZd~dr-xr-x---
- ls -lZd ~/.ssh drwx------
- ls -lZd ~/.ssh/authorized_keys -rw-------
답변1
너의 답CentOS 7은 SELinux에 의존합니다.:
restorecon -Rv ~/.ssh
답변2
제 경우에는 기본 권한을 변경했기 때문에 홈 디렉토리 권한으로 인해 비밀번호 없는 로그인이 작동하지 않았습니다. 마지막으로 이것은 나에게 효과적이었습니다. 내 홈 디렉터리 권한은 다음과 같습니다.
/홈/사용자 이름
drwxr----x. 18 username groupname 4096 May 11 11:52 username
/홈/사용자 이름/.ssh
268823097 drwx------ 2 username groupname 29 May 11 11:53 .ssh
/home/사용자 이름/.ssh/authorized_keys
-rw-r----- 1 username groupname 402 May 11 11:53 authorized_keys