Cpt. Chaz Posted August 12, 2020 Share Posted August 12, 2020 (edited) 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, 2020 by Cpt. Chaz Quote Link to comment
JorgeB Posted August 13, 2020 Share Posted August 13, 2020 Best way is to use SSH Key-Based Authentication so no password is needed. 1 Quote Link to comment
Cpt. Chaz Posted August 13, 2020 Author Share Posted August 13, 2020 even with vpn already set up between the machines? Quote Link to comment
Cpt. Chaz Posted August 13, 2020 Author Share Posted August 13, 2020 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. Quote Link to comment
JorgeB Posted August 13, 2020 Share Posted August 13, 2020 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 Quote Link to comment
Cpt. Chaz Posted August 13, 2020 Author Share Posted August 13, 2020 alright, i'll go the ssh key route then. thanks Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.