<div dir="ltr"><div dir="ltr">On Fri, Mar 11, 2022 at 4:57 AM Dr. Mark Asbach via rsync <<a href="mailto:rsync@lists.samba.org">rsync@lists.samba.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">b) Passing the password to sudo via stdin using --rsync-path "echo MYPASSWORD | sudo -S rsync" (see <a href="https://askubuntu.com/a/1155897" rel="noreferrer" target="_blank">https://askubuntu.com/a/1155897</a>).</blockquote><div><br></div><div>In that ask-ubuntu example they are running a client rsync via sudo, not the server side.  The server requires the socket to be on stdin, so you can't use stdin earlier on the command-line for something else.</div><div><br></div><div>One thing you could do is to create a custom askpass script that provides the password on stdout. You must put that script on each remote system because the SUDO_ASKPASS environment variable must only contain a program name, so it will not allow a one-line remote invocation (i.e. SUDO_ASKPASS="echo FOO" fails). For example, create a shell script named something like echo-askpass:</div><div><br></div><div>#!/bin/sh</div><div><font face="monospace">echo "$SUDO_PASS"</font></div><div><br></div><div>and then use this option to rsync:</div><div><br></div><div><font face="monospace">--rsync-path "SUDO_ASKPASS=/path/echo-askpass SUDO_PASS=MYPASS sudo -A rsync"</font></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">You could simplify that by moving those environment variables into your ansible config, perhaps by grabbing the password out of the ansible vault or having ansible prompt the user. That would let you run "sudo -A rsync" and not have the password in the command.  The ansible docs detail how to set remote environment variables.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">..wayne..</span></div></div></div>