I have three questions from the use of one rsync command, below:
sudo rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress <user>@<ip.address>:~/public_html/ /var/www/html
1.) How can change this command so that I can use it without passwords? I want to automate periodic uploads/downloads from my server with a cronjob. As is, I need to enter my local user pwd because the html folder is within the file system. Secondly, even though I have setup a ssh key with the remote host and I can establish a connection without entering my remote host password, this command prompts me enter the remote host pwd again (not recognizing saved ssh keys)
2.) Prior to using the above rsync command, my LAMP dev environment worked fine. However, after downloading my sites from the remote host via the above command, the permissions to files & directories changed. I believe the -a attribute maintained the remote host's username & permissions. How do I get my LAMP permissions back to what they were?
I already ran 'sudo chown -R www-data:www-data /var/www/html
', however, my wordpress sites now all redirect to the live production sites, example: https://localhost.sitename.org redirects to https://sitename.org/wp-signup.php?new=localhost
No, the /etc/hosts has not been edited and is set-up perfectly.
3.) What attributes should I use with the above rsync command as to avoid my current quagmire in the future? SSH w. RSYNC is clearly faster and more secure than any ftp. Just need help refining my usage of it. thanks.