D
D
dmitriy2019-07-23 23:26:47
SSH
dmitriy, 2019-07-23 23:26:47

How to solve the problem of deploying via ssh Permission denied (publickey)?

trying to transfer site files to a remote server in GitLab CI, using rsync + ssh
debugging shows

debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey
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: No more authentication methods to try.
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.2]

create private key $ echo "${SSH_PRIVATE_KEY}" >> /root/.ssh/id_rsa
public placed in authorization_keys on remote server file
permissions on client $ chmod 600 /root/.ssh/id_rsa
what else could be the problem Permission denied (publickey).?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CityCat4, 2019-07-24
@CityCat4

You need to upload your key to the server - ssh wants the key. You can’t do
a login as a root . Firstly, it’s a bad form. Secondly, it can be tritely closed - and then at least enter the correct password :) and even though you crack - but there will be no login :)

D
dmitriy, 2019-07-24
@dmitriylanets

in general, it was decided as follows
1. creating a new user
2. creating a new key pair
3. resetting the ssh config and specifying
PubkeyAuthentication yes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question