SSH: ssh-copy-id – Permission denied

Автор: | 27/09/2016
 

ssh_logoПри копировании RSA-ключа – ошибка:

$ ssh-copy-id -i ssh/id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

На боксе – проверяем содерждимое файла /etc/ssh/sshd_config, и ищем PasswordAuthentication:

# cat /etc/ssh/sshd_config | grep PasswordAuthentication
#PasswordAuthentication yes
PasswordAuthentication no
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication, then enable this but set PasswordAuthentication

Обновляем – меняем PasswordAuthentication no на PasswordAuthentication yes, и перезапускаем sshd:

# service sshd reload
Redirecting to /bin/systemctl reload  sshd.service

Проверяем:

$ ssh-copy-id -i ssh/id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

Готово.