I'm running a small code that uses fabric's rsync_project
function to connect to a remote machine and transfer a file to it. I've assigned env.password
with the password of the server.
However, when I run the code, I get prompted for password. After entering the password, the file gets transferred. But I do not want to get prompted.
Here's my code:
from fabric import environment
from fabric.contrib.project import rsync_project
env.hosts = ['172.16.154.134']
env.password = 'user@123'
def sync(remote_dir, local_dir):
rsync_project(remote_dir, local_dir)
Maybe I have misunderstood what env.password
is for. If so, please tell me some other way to get rid of the prompt that asks for password.
Thanks