ssh com novo usuário falhando com permissão negada (publickey)

0

Estou tentando criar um usuário no EC2, seguindo as etapas que realizei.

root$ adduser abc --disabled-password
root$ sudo su abc
abc$ mkdir /home/abc/.ssh
abc$ chmod 700 /home/abc/.ssh
abc$ touch /home/abc/.ssh/authorized_keys
abc$ chmod 600 /home/abc/.ssh/authorized_keys
abc$ cat id_rsa.pub >> /home/abc/.ssh/authorized_keys

Em seguida, tentei entrar neste EC2 como usuário, mas recebi o seguinte erro:

local$ ssh [email protected]
[email protected]: Permission denied (publickey).

Então eu tentei

local$ ssh [email protected] -vvv

OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/abc/.ssh/config
debug1: /Users/abc/.ssh/config line 33: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 45.121.95.191 port 22.
debug1: Connection established.
debug1: identity file /Users/abc/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.10
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.10 pat OpenSSH_6.6.1* compat 0x04000000
debug3: fd 5 is O_NONBLOCK
debug1: Authenticating to 45.121.95.191:22 as 'abc'
debug3: hostkeys_foreach: reading file "/Users/abc/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /Users/abc/.ssh/known_hosts:6
debug3: load_hostkeys: loaded 1 keys from 45.121.95.191
.
.
.
debug1: Host '45.121.95.191' is known and matches the ECDSA host key.
debug1: Found key in /Users/abc/.ssh/known_hosts:6
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 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 4294967296 blocks
debug2: key: /Users/abc/.ssh/id_rsa (0x7fa1a650aa30)
debug2: key: /Users/abc/.ssh/id_dsa (0x0)
debug2: key: /Users/abc/.ssh/id_ecdsa (0x0)
debug2: key: /Users/abc/.ssh/id_ed25519 (0x0)
debug3: send packet: type 5
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
debug3: start over, passed a different list publickey
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 public key: RSA SHA256:aQVTb3WY7P8cEgl2CF5f0XOUDtDbOvgj1SMMwPNlSfg /Users/abc/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/abc/.ssh/id_dsa
debug3: no such identity: /Users/abc/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /Users/abc/.ssh/id_ecdsa
debug3: no such identity: /Users/abc/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/abc/.ssh/id_ed25519
debug3: no such identity: /Users/abc/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).

Mesmo ssh -i /Users/abc/.ssh/id_rsa [email protected] apresenta o mesmo erro.

Estou tentando entender por que a autenticação do usuário não está funcionando. Estou suspeitando de algo errado com /home/abc/.ssh/authorized_keys . alguem pode ajudar?

ATUALIZAÇÃO:

Também isso em /var/log/auth.log

Address ${MyPublicIP} maps to ${InternetProvider}, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Connection closed by ${MyPublicIP} [preauth]
    
por user3579198 01.08.2018 / 22:42

1 resposta

0

Você deve depurar no servidor, o cliente ssh não pode lhe dizer muito.

Veja a entrada em / etc / shadow. A conta está desativada? É o segundo campo "*" ou "!"?

Editar:
Do seu log, parece ser um problema com a verificação do DNS. A verificação do DNS pode causar mais problemas do que resolve (contanto que você não faça logins com base no nome do host DNS, o que, espera-se, ninguém faz hoje em dia).

Em / etc / ssh / sshd_config, defina UseDNS no . Você também pode precisar de GSSAPIAuthentication no .

    
por 02.08.2018 / 00:30