Ho fornito una risposta su Stack Overflow che spiega il processo passo-passo necessario per impostare l'accesso senza password tramite SSH. Ecco quelle istruzioni adattate per le tue esigenze specifiche.
Innanzitutto, imposta la connessione SSH in modalità dettagliata usando il -vflag in questo modo:
ssh -v localhost
Come spiegato nella sshpagina man; accessibile tramite man ssh:
-v Verbose mode. Causes ssh to print debugging messages about its
progress. This is helpful in debugging connection, authentica-
tion, and configuration problems. Multiple -v options increase
the verbosity. The maximum is 3.
Questo mi ha risparmiato un sacco di mal di testa in passato mostrandomi esattamente come scorre il processo di accesso e cosa lo sta ostruendo esattamente. Ad esempio, ecco l'output di me che eseguo quel comando sul mio computer Mac OS X 10.9.5 locale:
ssh -v localhost
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /Users/JakeGould/.ssh/id_rsa type 1
debug1: identity file /Users/JakeGould/.ssh/id_rsa-cert type -1
debug1: identity file /Users/JakeGould/.ssh/id_dsa type -1
debug1: identity file /Users/JakeGould/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com 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: Server host key: RSA 01:aa:8e:8e:b9:e1:4b:e8:bd:c5:a2:20:a3:c7:f1:18
debug1: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in /Users/JakeGould/.ssh/known_hosts:43
debug1: ssh_rsa_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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/JakeGould/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/JakeGould/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password:
Come puoi vedere, viene visualizzata la richiesta della password. Ma prima controlla chiaramente la mia chiave pubblica RSA. E poiché non ne ho uno, passa semplicemente al prossimo metodo di autenticazione. Presta attenzione all'output di ssh -vquando lo esegui sul tuo set per vedere dove le cose vengono soffocate.
Assicurarsi inoltre che i file SSH sul computer di destinazione dispongano di autorizzazioni corrispondenti a quanto segue e siano di proprietà dell'account che tenta di accedere come mostrato nell'esempio seguente:
-rw------- [username] [usergroup] authorized_keys
-rw------- [username] [usergroup] id_rsa
-rw-r--r-- [username] [usergroup] id_rsa.pub
-rw-r--r-- [username] [usergroup] known_hosts
Quindi esegui questo comando chmodnel authorized_keysfile:
sudo chmod 600 ~/.ssh/authorized_keys
Ed esegui questo comando chmodsul id_rsafile:
sudo chmod 600 ~/.ssh/id_rsa
ssh -v localhost? Questo dovrebbe dirti su cosa potrebbe soffocare.