August 12, 20205 yr i'm setting up an rsync script, where the first command prompt's a request for the destination source's password. Ideally the script would enter the password for the rsync to run. but how exactly do i write that into the script (or is there another way?) i have no problem running this in terminal manually where i can type the password in, it looks like this: rsync -avhP --progress /source/file/path [email protected]:/destination/file/path [email protected]'s password: so writing the script, what should the entry to fill the password look like here? #!/bin/bash echo "Starting File Server Backup" echo "This May Take a While" #Backup and Sync local file server rsync -avhP --progress /source/file/path [email protected]:/destination/file/path [email protected]'s password: <-- what should i enter on this line? Edited August 13, 20205 yr by Cpt. Chaz
August 13, 20205 yr Community Expert Best way is to use SSH Key-Based Authentication so no password is needed.
August 13, 20205 yr Author 3 minutes ago, JoeUnraidUser said: Try adding "<<<password" to the end of the command: rsync -avhP --progress /source/file/path root@192.168.1.X:/destination/file/path <<<password Change "password" to your password. No dice. i've also tried variations of read and echo | sudo from write-ups in other forums with no luck either. i've also read warnings of putting passwords in scripts, but all i'm dealing with here are two of my personal private networks over vpn. no exposure from the inside or outside, so i'm not worried about it from a security standpoint.
August 13, 20205 yr Community Expert 17 minutes ago, Cpt. Chaz said: even with vpn already set up between the machines? Yes, AFAIK not easy (or even possible) to enter the ssh password with a script
Archived
This topic is now archived and is closed to further replies.