Permission denied (publickey,password). rsync: connection unexpectedly closed - gitlab

Viewed 421

I created a gitlab server. when I want to deploy I got this error message:

$ eval $(ssh-agent -s)
Agent pid 258
$ mkdir -p ~/.ssh
$ echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_dsa
$ chmod 600 ~/.ssh/id_dsa
$ echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
$ rsync  -azlh -e 'ssh -p 5432' $CI_PROJECT_DIR/ root@*.**.***.****:/var/www/html/****.com/public_html/
Warning: Permanently added '[*.***.**.***]:5432' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1 

my server is ubuntu.

1 Answers

If your GitLab server version is more recent than 11.0 (June 2018), keep in mind that id_dsa ('dsa', not 'rsa') is marked as "deprecated" in "GitLab and SSH keys" documentation:

See "Support for DSA SSH keys"

Due to published weakness in the ssh-dsa algorithm, we’ll wind down support for DSA SSH keys.
In 11.0, the default value for the DSA SSH keys setting is “Are forbidden”. This setting is located in the visibility and access controls section of the Settings admin panel.

This setting may be overridden if desired.
Beginning in 12.0, GitLab will always reject DSA SSH keys.

Planned removal date: June 22, 2018

It is best to create keys like:

ssh-keygen -t ed25519 -C "<comment>"
# or
ssh-keygen -t rsa -b 2048 -C "<comment>"
Related