Missing begin marker error com chave pública ssh login

0

Eu tenho duas máquinas Redhat 7.3. Eu quero acesso ssh sem senha para a máquina2 da máquina1. Aqui está o que eu fiz. Na máquina1, sudo ( sudo su - ) como raiz e gerava as chaves públicas e privadas rsa usando o comando ssh-keygen com todas as configurações padrão. Eles estão presentes no diretório /root/.ssh/ com nomes id_rsa, id_rsa.pub As permissões para .ssh são as seguintes

drwx------  2 root root   54 Jan 17 05:08 .
drwxr-x---. 7 root root 4.0K Jan 17 04:08 ..
-rw-------  1 root root 1.7K Jan 17 06:18 id_rsa
-rw-r--r--  1 root root  414 Jan 17 06:18 id_rsa.pub
-rw-r--r--  1 root root 4.0K Jan 17 07:37 known_hosts

Eu copiei o conteúdo de id_rsa.pub para machine2 no arquivo authorized_keys in /root/.ssh criado por mim mesmo como raiz. permissões do diretório .ssh na máquina2 são as seguintes

drwxr-xr-x  2 root root   28 Jan 17 06:32 .
dr-xr-x---. 6 root root 4.0K Jan 17 03:28 ..
-rw-r--r--  1 root root  414 Jan 17 06:32 authorized_keys

Agora eu tentei ssh (com verbose) de machine1 para machine2 usando o seguinte comando. Mas ainda pede a senha para se conectar. Espero que a conexão seja estabelecida sem pedir senha.

Eu tentei alterar as permissões de .ssh e authorized_keys para 700 e 600 na máquina2 como sugerido por O SSH solicita a senha, mesmo com a chave pública instalada Mas o problema persiste.

Eu dei a saída de depuração do comando ssh. Funciona como esperado até o servidor aceitar a chave pública. Depois disso eu notei debug1: key_parse_private2: missing begin marker pode estar causando esse problema. Alguém pode me sugerir uma saída para esse problema?

[root@machine1 ~]# ssh -v machine2
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to machine2 [x.x.x.x] 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: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
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: kex: [email protected] need=16 dh_need=16
debug1: kex: [email protected] need=16 dh_need=16
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA X:X:X:X:....
debug1: Host 'machine2' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
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
========================================================
| The system is to be used only by authorized users.   |
|                                                      |
| By continuing to use the system, the user represents |
|         that he/she is an authorized user.           |
|                                                      |
| Use of the system constitutes consent to monitoring  |
|                   and review.                        |
|                                                      |
|  I have received, read and understand the Company's  |
|   Acceptable Use Policy and agree to abide by the    |
|       policy and its terms and conditions.           |
|                                                      |
========================================================
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: password
root@machine2's password: 
    
por Ravi Chandra 18.01.2017 / 10:34

1 resposta

0

"Marcador de início ausente" não é realmente um problema, você obtém essa mensagem com logins de chave pública sem senha bem-sucedidos.

Você tem um banner, então você provavelmente fez um pouco de endurecimento. Certifique-se de que as seguintes opções estejam disponíveis para o seu usuário. Você pode adicioná-los no final do seu arquivo sshd_config depois de uma linha "Match User":

Match User root,user1
RSAAuthentication yes
PubkeyAuthentication yes
PermitRootLogin yes
PermitEmptyPasswords yes

PermitRootLogin só é necessário desde que você use root. Não tenho certeza se o PermitEmptyPasswords é obrigatório, mas funciona para mim.

Outra coisa (pequena), não sudo su - , do sudo -i .

    
por 07.07.2017 / 18:02