FILES SYNCHRONIZATION TO REMOTE SERVER USING RSYNC & SSH WITHOUT ANY PASSWORD

In this tips, I'm using CentOS 6.5

Installation:

Download and install Rsync and openssh via repository.
# yum install rsync openssh-server openssh-clients

Creating public & private key using ssh-keygen:

# ssh-keygen
Choose the location to store your ssh keys, and remember it ^^. Type passphrase or just skip it by press Enter.

Copying public key to the remote server using ssh-copy-id:

# ssh-copy-id -i <path-to-key>/<keyname>.pub "<remote-server-address> -p<port>" Use " " for remote server address if the ssh's port is modified.

Checking ssh login without password: 

# ssh -i <path-to-key>/<keyname> <remote-server-address> The <keyname> here is the name of your private key, the file has same name with the public key but it doesn't contain .pub extension.
If you can login to the remote server without given any password it means you're setup correctly.

Synchronizing using rsync:

# rsync -ar -e 'ssh -i <path-to-key>/<keyname> -p<port>' <path-to-source> <user>@<remote-server-address>:<path-to-destination>

Comments

Popular Posts