I want to make a script file to copy or sync data from one server to another without asking any password also before copying file i want to know the numbers of the files to be copied & if i say yes then only it will copy on remote server.
I request you to explain more clearly with solution, so that the user will understand properly and also make sure to preview the post before replying to user to avoid any errors. All I want is to keep this forum clean, formatted with proper information…
#first generate a ssh key on source machine1
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
#Just leave blank when asked for a passfrase and hit enter
#copy your public key to destination machine2
ssh-copy-id -i ~/.ssh/id_rsa.pub username@machine2
#replace machine2 with ip address of machine2 if necessary and username with your own
#sync /home/username/folder to /home/username/folder on machine2
rsync -avzP /home/username/folder -e ssh username@machine2/home/username/
i also want to know the number of the files to be copied before i sync and if i say yes then only it will start copying
how to make the script for that