Estou usando o Ubuntu 15.10 e estou tendo problemas para efetuar login através do ssh sem senha, embora tenha adicionado minhas chaves ssh. Ele estava trabalhando antes e depois parou de funcionar. Eu não sei exatamente o que fiz para que parasse de funcionar. Você poderia me ajudar a resolver isso? Existe uma maneira de redefinir tudo e começar do começo?
Ao tentar consertá-lo, eu corri várias vezes, mas sem sucesso, os dois seguintes comandos:
ssh-keygen -t rsa
ssh-copy-id myusername@remotehost
Agora na máquina remota, quando eu faço:
cat authorized_keys
Isso me dá três chaves.
E na máquina do cliente:
Aqui estão as permissões que eu tenho para a pasta .ssh:
drwx------ 2 user user 4096 Apr 18 09:44 .ssh
E aqui estão as permissões dentro dessa pasta:
-rw------- 1 user user 822 Apr 15 13:08 authorized_keys
-rw------- 1 user user 1679 Apr 18 09:44 id_rsa
-rw-r--r-- 1 user user 411 Apr 18 09:44 id_rsa.pub
-rw-r--r-- 1 user user 2335 Apr 14 16:06 known_hosts
Aqui está a saída detalhada:
$ ssh -v user@localhost
OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1: match: OpenSSH_6.9p1 Ubuntu-2ubuntu0.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:/CGAtknCe0ao9c+ZRoBDrbdBEaoweEKCtN0r+gO9Nyg
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:6
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 RSA public key: /home/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Trying private key: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Trying private key: /home/user/.ssh/id_ed25519
debug1: Next authentication method: password
Eu só notei isso e em casa, vai ser uma dica para algo:
debug1: Offering RSA public key: /home/user/.ssh/id_rsa
42 debug1: Server accepts key: pkalg ssh-rsa blen 279 42 debug1: Server accepts key: pkalg ssh-rsa blen 279
43 debug1: Trying private key: /home/user/.ssh/id_dsa 43 debug1: Trying private key: /home/user/.ssh/id_dsa
44 debug1: Trying private key: /home/user/.ssh/id_ecdsa 44 debug1: Trying private key: /home/user/.ssh/id_ecdsa
45 debug1: Trying private key: /home/user/.ssh/id_ed25519 45 debug1: Trying private key: /home/user/.ssh/id_ed25519
Eu não tenho esses arquivos na minha pasta .ssh, aqui está o que eu tenho:
-rw------- 1 user user 1233 Apr 18 12:31 authorized_keys
-rw------- 1 user user 1679 Apr 18 09:44 id_rsa
-rw-r--r-- 1 user user 411 Apr 18 09:44 id_rsa.pub
-rw-r--r-- 1 user user 2335 Apr 14 16:06 known_hosts
Obrigado