2

I'm having issues trying to rsync files over from a build server to a web server.

the command im running is

rsync -e "ssh -i ${HOME}/.ssh/id_rsa" --rsync-path="sudo rsync" -avh --chown=nobody:webdev --chmod=Dg+s,ug+w --delete --exclude-from=deployment_rsync-excludes.txt ./ deploy-user@PROD01:/${my.application.web.root}/${bamboo.deploy.release}/

The CI agent throws this error

sudo: no tty present and no askpass program specified

rsync: connection unexpectedly closed (0 bytes received so far) [sender]

rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]

If i tail -f /var/log/auth.log on the target server i get this error

May 26 10:09:45 {some_webserver} sshd[30809]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
May 26 10:09:45 {some_webserver} sshd[30809]: Accepted publickey for {deploy-user} from {some_ip} port 36883 ssh2: RSA {some_hash}
May 26 10:09:45 {some_webserver} sshd[30809]: pam_unix(sshd:session): session opened for user {deploy-user} by (uid=0)
May 26 10:09:46 {some_webserver} sshd[30896]: Received disconnect from {some_ip}: 11:
May 26 10:09:46 {some_webserver} sshd[30809]: pam_unix(sshd:session): session closed for user svcacct-deploy
May 26 10:09:46 {some_webserver} sshd[30898]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
May 26 10:09:46 {some_webserver} sshd[30898]: Accepted publickey for svcacct-deploy from{some_ip}  port 36888 ssh2: RSA  {some_hash}
May 26 10:09:46 {some_webserver} sshd[30898]: pam_unix(sshd:session): session opened for user {deploy-user} by (uid=0)
May 26 10:09:47 {some_webserver} sudo: pam_unix(sudo:auth): conversation failed
May 26 10:09:47 {some_webserver} sudo: pam_unix(sudo:auth): auth could not identify password for [{deploy-user}]
May 26 10:09:47 {some_webserver} sudo: {deploy-user} : user NOT authorized on host ; TTY=unknown ; PWD=/home/svcacct-deploy ; USER=root ; COMMAND=/usr/bin/rsync --server -vlogDtpre.iLs --delete --usermap=*:nobody --groupmap=*:webdev . ${my.application.web.root}/${bamboo.deploy.release}/
May 26 10:09:47 {some_webserver} sshd[30968]: Received disconnect from 146.215.253.134: 11: disconnected by user
May 26 10:09:47 {some_webserver} sshd[30898]: pam_unix(sshd:session): session closed for user {deploy-user}

server is running ubuntu 14.04.

Any help resolving this matter would be greatly appreciated

Jenny D
  • 27,780
  • 21
  • 75
  • 114
James Kirkby
  • 168
  • 2
  • 9

1 Answers1

1

I believe the answer is in the log file

pam_unix(sudo:auth): auth could not identify password for [{deploy-user}]

{deploy-user} : user NOT authorized on host

I would make sure you can ssh deploy-user@PROD01

This link might also be helpful to setup rsync over ssh https://www.digitalocean.com/community/tutorials/how-to-copy-files-with-rsync-over-ssh

prodigerati
  • 174
  • 1
  • 8
  • the user is managed by LDAP so in our sshd_config we get the users authed key like AuthorizedKeysCommand /usr/local/bin/ldap_keys.sh i think its something to do with not being able to sudo, but the servers cloned from another server where the deploy user has access – James Kirkby May 26 '16 at 15:24
  • Can you login with deploy-user on the server you trying to rsync to via ssh or terminal? If not, LDAP config might need to be fixed on that server before rsync / ssh will work. – prodigerati May 26 '16 at 15:47
  • Thanks, this helped me. My password was out dated it seemed. After doing ssh myusername@myserver.com it asked me to set a new password for the ssh connection. After this, everything worked fine again. – Laurin Herbsthofer Jan 13 '23 at 09:48