LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Question About Resync Command (https://www.linuxquestions.org/questions/linux-newbie-8/question-about-resync-command-768686/)

Un!x85 11-12-2009 10:58 AM

Question About Resync Command
 
hi

i want to resync folder from server to another automaticly with the following command :

Code:

rsync -arzgopu -e "ssh -p 1111" /backups/cpbackup/daily user@ip:/backup
but reqire password , that made it manually

i want some help about it and to find a way to make a bash script or someting transfer with password included automaticlly not wrote it .

i will be appreicated,
thanks

MensaWater 11-12-2009 11:12 AM

Rather than storing the password which is a security risk you might want to think about setting up an ssh trust. This allows the login to occur without a password based on ssh keys.

Basic steps are:
1) Run ssh-keygen as the source user on the source host to create a public and private key pair. (Type "man ssh-keygen" to see options.)

2) Copy the the public key created (typically in $HOME/.ssh directory of the source user) into authorized_keys files of the target user on the target host (again in $HOME/.ssh directory).

Once you do that you can test by simply doing "ssh targetuser@targethost. If it works you'll have a shell prompt there.

Note a couple of gotchas. The home directory for each host should be writable only by the user that owns it (it can be read/execute for everyone but not writable by anyone by user). The $HOME/.ssh should only be read write for the user that owns it. No one else should be able to read or write it. If thse conditions aren't met it won't be considered "trusted" and won't work.


All times are GMT -5. The time now is 09:22 PM.