No tty present and no askpass program specified

I am trying to rsync files from NodeA to NodeB.

Using the below command.

/usr/bin/rsync  -v -a -e "ssh" --rsync-path="sudo -u msd rsync" /home/ansible/templates/app/Sprint6/webapps eric@NodeB:/opt/msdp/ca/iam_cac

I can only ssh into NodeB as eric user but I want files placed as msd user.

I am getting 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(600) [sender=3.0.6]

On the remote node, I have given eric sudo provlegaes.

eric ALL = NOPASSWD: /usr/bin/rsync

is there something else that I am missing ?

sudo looks trying to execute the command interactivly, use the -s option (or check the man sudo to get the relevant options & syntax depending on your OS)

sudo won't need to do anything interactive unless it requires a password, is the thing. That's exactly what the error means - that it needs to ask for a password but has no means to do so.

Does sudo work in shell when you ssh to eric@nodeb?

I have passwordless access enabled to nodeB.

[ansible@nodeA]$ ssh eric@nodeB
Last login: Mon Oct 31 12:55:35 2016 from 10.169.102.6
[eric@nodeB ~]$

Yes, ssh works, but does sudo?