From ef13a6049e3a1f5c5a61298aab7a8e30382007be Mon Sep 17 00:00:00 2001 From: victor Date: Sat, 13 Apr 2024 12:36:16 +0200 Subject: [PATCH] Configurated to work with public/private key --- automateRsync.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/automateRsync.py b/automateRsync.py index 29acb19..a43bcdd 100644 --- a/automateRsync.py +++ b/automateRsync.py @@ -1,13 +1,13 @@ import os -def rsyncConection(src, dest, user, host, password_file): - conn = f"rsync --rvpog --times --atimes --update --delete {src} {user}@{subprocess.call(["ls", "-l"])}:{ruta_final}" +def rsyncConection(src, dest, user, host): + ssh = "'ssh -i ~/.ssh/id_rsa'" + conn = f"rsync -rvpog --times --atimes --update --delete -e 'ssh -i ~/.ssh/id_rsa' {src} {user}@{host}:{dest}" os.system(conn) if __name__ == "__main__": - src = "" - dest = "" - user = "" - host = "" - password_file = "" - rsyncConection(src, dest, user, host, password_file) \ No newline at end of file + src = "test.txt" + dest = "/home/userpi/" + user = "userpi" + host = "victor.raspberrypi" + rsyncConection(src, dest, user, host) \ No newline at end of file