rsync:连接意外关闭-没有tty存在

rsync:连接意外关闭-没有tty存在

我在尝试将文件从构建服务器 rsync 到 Web 服务器时遇到问题。

我正在运行的命令是

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}/

CI 代理抛出此错误

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]

如果我在目标服务器上 tail -f /var/log/auth.log 我会收到此错误

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}

服务器正在运行 ubuntu 14.04。

任何帮助解决此问题的人都将不胜感激

答案1

我相信答案就在日志文件中

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

{deploy-user} : user NOT authorized on host

我会确保你能ssh deploy-user@PROD01

此链接可能对通过 ssh 设置 rsync 也有帮助https://www.digitalocean.com/community/tutorials/how-to-copy-files-with-rsync-over-ssh

相关内容